#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, p = 101, q = -1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    p = min(p, a);
    q = max(q, a);
  }
  cout << q - p << endl;
}
