#include <bits/stdc++.h>
using namespace std;
int my_abs(int num) {
  if (num > 0)
    return num;
  else
    return -num;
}
int main() {
  int N;
  vector<int> houses(N);
  for (int i = 0; i < N; i++) {
    cin >> houses.at(i);
  }
  sort(houses.begin(), houses.end());
  reverse(houses.begin(), houses.end());
  cout << houses.at(0) - houses.at(N - 1) << endl;
}
