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