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