#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  int min = 1001, max = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a < min) min = a;
    if (a > max) max = a;
  }
  printf("%d\n", max - min);
  return 0;
}
