#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, i, x;
  cin >> N;
  int number[N];
  for (i = 1; i <= N; i++) {
    cin >> number[i];
  }
  int max, min = 0;
  max = min = number[0];
  for (x = 1; x <= N; x++) {
    if (number[x] > max) max = number[x];
    if (number[x] < min) min = number[x];
  }
  cout << max - min << endl;
}
