#include <bits/stdc++.h>
using namespace std;
using LL = long long;
int main(void) {
  int n;
  cin >> n;
  int maxn = 0, minn = 10000;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    maxn = max(maxn, a);
    minn = max(minn, a);
  }
  cout << maxn - minn << endl;
  return 0;
}
