#include <bits/stdc++.h>
using namespace std;
int main() {
  int num;
  cin >> num;
  int min = 0;
  int max = 0;
  for (int i = 0; i < num; i++) {
    int temp;
    cin >> temp;
    min = min > temp ? temp : min;
    max = max < temp ? temp : max;
  }
  cout << max - min;
}
