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