#include <iostream>
using namespace std;

int n,a,maxx,minn=1010;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>a;
		if(a>maxx) maxx=a;
		if(a<minn) minn=a;
	}
	cout<<maxx-minn<<endl;
	return 0;
}