import java.util.Scanner;
class Main{
public static void main(String[]args){
Scanner scan=new Scanner(System.in);
  int a=scan.nextInt();
  int min=1145141919;
  int max=0;
  for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  }
  System.out.println(max-min);
}
} import java.util.Scanner; Scanner java.util class Main{
public static void main(String[]args){
Scanner scan=new Scanner(System.in);
  int a=scan.nextInt();
  int min=1145141919;
  int max=0;
  for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  }
  System.out.println(max-min);
}
} Main public static void main(String[]args){
Scanner scan=new Scanner(System.in);
  int a=scan.nextInt();
  int min=1145141919;
  int max=0;
  for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  }
  System.out.println(max-min);
} main {
Scanner scan=new Scanner(System.in);
  int a=scan.nextInt();
  int min=1145141919;
  int max=0;
  for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  }
  System.out.println(max-min);
} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan int min=1145141919; min 1145141919 int max=0; max 0 for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  } int i=0; int i=0; i 0 i<a i a i++ i++ i {
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  } {
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  } int b=scan.nextInt(); b scan.nextInt() scan.nextInt scan if(b>max){
    max=b;
    } b>max b max {
    max=b;
    } max=b max b if(b<min){min=b;} b<min b min {min=b;} min=b min b System.out.println(max-min) System.out.println System.out System System.out max-min max min String[]args args
import java.util.Scanner;
class Main{
public static void main(String[]args){
Scanner scan=new Scanner(System.in);
  int a=scan.nextInt();
  int min=1145141919;
  int max=0;
  for(int i=0;i<a;i++){
  int b=scan.nextInt();
    if(b>max){
    max=b;
    }
    if(b<min){min=b;}
  }
  System.out.println(max-min);
}
}