#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; ++i) cin >> v[i];

    cout << *std::max_element(a.begin(), a.end()) - *std::min_element(a.begin(), a.end()) << endl;
    int sum = accumulate(v.begin(), v.end(), 0);

    return 0;
}
