#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[1000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a, a + N);
  N = a[N] - a[0];
  cout << N << endl;
}
