include<iostream>
using namespace std;
int main(){
        int N;
        int min, max,a;
        min = 1010;
        max = -1;
        cin>>N;
        for(int i=0;i<N;i++){
                cin>>a;
                if(min>a)
                        min = a;
                if(max<a)
                        max = a;
        }
        cout<<max-min<<endl;

}