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