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