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