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