#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  vector<int> vec(100);
  cin >> N;
  for (int i = 0; i < N; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  int length = 0;
  length = vec[N] - vec[0];
  cout << length << endl;
}
