#include<iostream>
using namespace std;
int main(){
	int n,a[110],i,x=-1,y=1001;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
		if(a[i]>x)
			x=a[i];
		if(a[i]<y)
			y=a[i];
	}

	cout << x-y << endl;
}
