#include <bits/stdc++.h>
int a[1009];
int main() {
  int n;
  scanf("%d", &n);
  int min = 200;
  int max = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] > max) {
      max = a[i];
    }
    if (a[i] < min) {
      min = a[i];
    }
  }
  printf("%d\n", max - min);
}
