#include <bits/stdc++.h>
int main() {
  int no_of_houses;
  scanf("%d", &no_of_houses);
  int min_house = 100, max_house = 1;
  while (no_of_houses--) {
    int distance;
    scanf("%d", &distance);
    min_house = (min_house < distance ? min_house : distance);
    max_house = (max_house > distance ? max_house : distance);
  }
  printf("%d\n", max_house - min_house);
  return 0;
}
