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