#include<iostream>
using namespace std;
int main()
{
int a[1000],n,max=-10000000,min=10000000;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>max)
max=a[i];
if(a[i]<min)
min=a[i];}
cout<<max-min;
 
return 0;
}