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