#include <bits/stdc++.h>
int main() {
  int N;
  scanf(" %d", &N);
  int max = 0;
  int min = 10000;
  for (int i = 0; i < N; i++) {
    int a;
    scanf(" %d", &a);
    max = a > max ? a : max;
    min = a < min ? a : min;
  }
  printf("%d\n", max - min);
}
