#include <bits/stdc++.h>
using namespace std;
const long long mod = 100000000000;
int n;
int a[102];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int min = mod;
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (min > a[i])
      min = a[i];
    else if (max < a[i])
      max = a[i];
  }
  cout << max - min << endl;
  ;
  return 0;
}
