#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long a;
  vector<long long> b(a);
  for (long long i = 0; i < a; i++) cin >> b.at(i);
  sort(b.begin(), b.end());
  cout << b.at(a - 1) - b.at(0);
}
