#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, a, min = 1001, max = -1;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a < min) {
      min = a;
    } else if (a > max) {
      max = a;
    }
  }
  printf("%d", max - min);
  return 0;
}
