#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  cout << max(l.begin(), l.end()) - min(l.begin(), l.end()) << endl;
  return 0;
}
