#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a, u = -1, d = 10000;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    u = max(u, a);
    d = max(d, a);
  }
  cout << u - d;
  return 0;
}
