#include <iostream>
#include <algorithm>
using namespace std;
int a[105];
int main(){
	int n;
	cin>>n;
	for(int i=0;i<n;++i) cin>>a[i];
	cout<<(*max_element(a,a+n))-(*min_element(a,a+n))<<endl;
	return 0;
}