#include <iostream>
using namespace std;

int main() {
  int n,mx=0,mn=1919;
  cin>>n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin>>a;
    mx=max(a,mx);
    mn=min(a,mn);
  }
  cout<<mx-mn<<endl;
}
