#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  std::vector<int> points;
  cin >> N;
  points.resize(N);
  for (int i = 0; i < N; ++i) {
    cin >> points[i];
  }
  sort(points.begin(), points.end());
  cout << (points[N - 1] - points[0]);
  return -1;
}
