#include "bits/stdc++.h"
using namespace std;


int main() {
    int n;
    cin >> n;
    vector< int> v(n);
    for (int &e : v) cin >> e;
    sort(begin(v), end(v));
    cout << v.back() - v[0] << endl;
}