#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, arr[10000], max, min;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  max = -1;
  for (int i = 0; i < n; i++) {
    if (arr[i] > max) max = arr[i];
  }
  min = 1000000000;
  for (int i = 0; i < n; i++) {
    if (arr[i] < min) min = arr[i];
  }
  b = max - min;
  cout << b << endl;
  return 0;
}
