#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int min = INT_MAX, max = 0, n, t;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t;
    if (t < min) min = t;
    if (t > max) max = t;
  }
  cout << max - min << endl;
  return 0;
}
