#include <stdio.h>

int main (void)
{
  int n , min = 10000 , max = 0;
  scanf("%d",&n);
  int a[n];
  for(int i = 0;i < n; i ++){
    scanf("%d",&a[i]);
    if(min>a[i]){
      min = a[i];
    }
    if(max<a[i]){
      max = a[i];
    }}
  
 printf("%d",max - min);
 return 0;