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