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