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