#include<iostream>
#include<algorithm>
using namespace std;
long long i,n,maxn=-1000000001,minn=1000000001,s;
int main()
{
	cin>>n;
	for(i=1;i<=n;i++) 
	{
		cin>>s; 
		if(maxn<s) maxn=s; 
		if(minn>s) minn=s;
	}
	cout<<maxn-minn;
	return 0;
}