#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void solve() {
  int n;
  int max = 0, min = 100;
  vector<int> a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
    if (max < a[i]) {
      max = a[i];
    }
    if (min > a[i]) {
      min = a[i];
    }
  }
  cout << max - min << endl;
}
int main() {
  solve();
  return 0;
}
