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