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