#include<iostream> using namespace std; int main() { int n,minn,maxn,num; cin>>n; maxn=0; minn=1001; while(n--){ cin>>num; if(num<minn){ minn=num; } if(num>maxn){ maxn=num; } } cout<<maxn-minn; return 0; }