#include <bits/stdc++.h>
using namespace std;
int int_sort(const void *a, const void *b) {
  if (*(int *)a < *(int *)b) {
    return -1;
  } else if (*(int *)a == *(int *)b) {
    return 0;
  }
  return 1;
}
int max_array(int n[], int len) {
  int i, tmp;
  tmp = n[0];
  for (int i = 1; i < len; i++) {
    if (tmp < n[i]) {
      tmp = n[i];
    }
  }
  return tmp;
}
int min_array(int n[], int len) {
  int i, tmp;
  tmp = n[0];
  for (int i = 1; i < len; i++) {
    if (tmp > n[i]) {
      tmp = n[i];
    }
  }
  return tmp;
}
int main() {
  int N;
  cin >> N;
  int ai[1000];
  int counti = 0;
  while (cin >> ai[counti]) {
    counti++;
  }
  int data_cnt = 0;
  data_cnt = sizeof(ai) / sizeof(ai[0]);
  for (counti = 0; ai[counti] != 0; counti++) {
    qsort((void *)ai, data_cnt, sizeof(ai[0]), int_sort);
  }
  int ans = max_array(ai, data_cnt) - min_array(ai, data_cnt);
  cout << ans << endl;
  return 0;
}
