#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int N;
    vector<int> pos;
    int temp;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> temp;
        pos.push_back(temp);
    }
    
    int min = *min_element(pos.begin(), pos.end());
    int max = *max_element(pos.begin(), pos.end());

    cout >> max-min >> endl;
    return 0;
}