#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int vmin, vmax;
  vmin = 10000;
  vmax = 0;
  cin >> N;
  int l[N];
  for (int i = 0; i < N; i++) {
    cin >> l[i];
  }
  for (int i = 0; i < N; i++) {
    if (vmin > l[i]) {
      vmin = l[i];
    } else if (vmax < l[i]) {
      vmax = l[i];
    }
  }
  cout << vmax - vmin << endl;
  return 0;
}
