#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long int n, max = 0, min = 99999999, sum = 0;
  cin >> n;
  vector<unsigned long int> a(n);
  for (unsigned long int i = 0; i < n; i++) {
    cin >> a.at(i);
    if (a.at(i) > max) max = a.at(i);
    if (a.at(i) < min) min = a.at(i);
  }
  cout << max - min << endl;
}
