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