#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> pos(N);
  for (int i = 0; i < N; i++) {
    cin >> pos[i];
  }
  sort(pos.begin(), pos.end());
  int max, min, ans;
  max = pos[N];
  min = pos[0];
  ans = max - min;
  cout << ans << endl;
}
