#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;
int main() {
  int N, mi = mod, ma = -mod;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    mi = min(tmp, mi), ma = max(tmp, ma);
  }
  cout << ma - mi << endl;
}
