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