import java.util.Scanner;

class Main{
  public static void main (String[] args){
  
    Scanner scanner=new Scanner(System.in);
    int n=scanner.nextInt();
    
    int max=0;
    int min=0;

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

    for(int i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  }
    System.out.println(max-min);
  }
} Main public static void main (String[] args){
  
    Scanner scanner=new Scanner(System.in);
    int n=scanner.nextInt();
    
    int max=0;
    int min=0;

    for(int i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  }
    System.out.println(max-min);
  } main {
  
    Scanner scanner=new Scanner(System.in);
    int n=scanner.nextInt();
    
    int max=0;
    int min=0;

    for(int i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  }
    System.out.println(max-min);
  } Scanner scanner=new Scanner(System.in); scanner new Scanner(System.in) int n=scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int max=0; max 0 int min=0; min 0 for(int i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  } {
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  } int a =scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner if(i==0){
      max=a;
      min=a;
    } i==0 i 0 {
      max=a;
      min=a;
    } max=a max a min=a min a if(a>max){
      max=a;
    } a>max a max {
      max=a;
    } max=a max a if(a<min){
      min=a;
    } a<min a min {
      min=a;
    } min=a min a 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 scanner=new Scanner(System.in);
    int n=scanner.nextInt();
    
    int max=0;
    int min=0;

    for(int i=0;i<n;i++){
      int a =scanner.nextInt();
     if(i==0){
      max=a;
      min=a;
    }
    if(a>max){
      max=a;
    }
    if(a<min){
      min=a;
    }
  }
    System.out.println(max-min);
  }
}