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