#include <bits/stdc++.h>
int main(void) {
  int N, a;
  int min, max;
  int i;
  scanf("%d", &N);
  min = max = 0;
  i = 0;
  while (i < N) {
    a = 0;
    scanf("%d ", &a);
    if (max < a) {
      max = a;
    }
    if (a < min) {
      min = a;
    }
    i++;
  }
  printf("%d", max - min);
  return 0;
}
