#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int t = N - 1;
  int a[t];
  for (int c = 0; c < N; c++) {
    cin >> a[c];
  }
  sort(a, a + t);
  cout << a[t] - a[0] << "\n";
  return 0;
}
