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