#include <iostream>
#include <vector>

int N;

using namespace std;

int main(){
  cin >> N;
  int maxa = -1; mina = 10000;
  vector<int> a(N);
  for(int i = 0; i < N; i++){
    cin >> a[i];
    if(a[i] <= mina) mina = a[i];
    if(a[i] >= maxa) maxa = a[i];
  }
  cout << maxa - mina;
}