#include <bits/stdc++.h>
using namespace std;
void solve() {
  long N;
  cin >> N;
  vector<long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long max = *max_element(A.begin(), A.end());
  long min = *min_element(A.begin(), A.end());
  cout << max - min;
}
int main() {
  solve();
  return 0;
}
