#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
  int N;

  cin >> N;

  int a[N - 1];

  for(int c = 0; c < N,c++){
    cin >> a[c];
  }

  sort(a.begin(),a.end());

  cout << a[N -1] - a[0] << "\n";
  
  return 0;
}