#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
template <class T>
void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
int atcoder() {
  int n;
  cin >> n;
  int mina = INT_MAX;
  int maxa = 0;
  for (int i = 0; i < n; ++i) {
    int tmp;
    cin >> tmp;
    maxa = max(maxa, tmp);
    mina - min(mina, tmp);
  }
  cout << maxa - mina << "\n";
  return 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  atcoder();
  return 0;
}
