#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, min = 101, max = 0;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a.at(i);
  for (int i = 0; i < N; i++) {
    if (a.at(i) > max) max = a.at(i);
    if (a.at(i) < min) min = a.at(i);
  }
  cout << max - min << endl;
  return 0;
}
