#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int house[n];
  for (int i = 0; i < n; i++) {
    cin >> house[i];
  }
  int max = 0, min = 10000;
  for (int i = 0; i < n; i++) {
    if (max < house[i]) {
      max = house[i];
    }
    if (min > house[i]) {
      min = house[i];
    }
  }
  printf("%d\n", max - min);
}
