#include <bits/stdc++.h>
int main(void) {
  int n;
  int a;
  int min = 1000;
  int max = 0;
  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\n", max - min);
  return 0;
}
