#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < (N); i++) {
    cin >> a.at(i);
  }
  int aMax = 0, aMin = 10 ^ 5;
  for (int i = 0; i < (N); i++) {
    aMax = max(aMax, a.at(i));
    aMin = min(aMin, a.at(i));
  }
  int ans = aMax - aMin;
  cout << ans << endl;
  return 0;
}
