#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
  int N,A,MIN=1001,MAX=-1;
  cin>>N;
  for(int i=1; i<=N; ++i)
    cin>>A;
    if(MIN>A) MIN=A;
    if(MAX<A) MAX=A;
}
  cout<<MAX-MIN<<endl;
}
