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