#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, a[101], i;
  cin >> N;
  for (i = 1; i <= N; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + N + 1);
  cout << a[N] - a[1] << endl;
  return 0;
}
