#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> vc(N);
    for(int i=0;i<N;i++)    cin >> vc[i];
    sort(vc.begin(),vc.end());
    cout << vc[N-1]-vc[0] << endl;
}