#include<iostream>
#include<algorithm>
using namespace std;
int i,n,maxn=-99999999,minn=99999999,s;
int main()
{
	cin>>n;
	while(n--) {cin>>s; maxn=max(maxn,s); minn=min(minn,s);}
	cout<<maxn-minn;
	return 0;
}