//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <numeric>
typedef long long Int;
#define rep(i,a,b) for(Int i=a;i<b;++i)
#define rrep(i,a,b) for(Int i=a;i>=b;--i)
using namespace std;

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

    int N, vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << endl;
}
