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