import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  }
} Main public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  } main {
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc double min = Math.pow(10,10); min Math.pow(10,10) Math.pow Math 10 10 double max = 0; max 0 for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    } {
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    } double target = sc.nextInt(); target sc.nextInt() sc.nextInt sc if(min > target){
         min = target;
      } min > target min target {
         min = target;
      } min = target min target if(max < target){
        max = target;
      } max < target max target {
        max = target;
      } max = target max target System.out.println((int)(max - min) ) System.out.println System.out System System.out (int)(max - min) max min String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    int n = sc.nextInt();
    double min = Math.pow(10,10);
    double max = 0;
    for(int i=0; i<n; i++){
      double target = sc.nextInt();
      if(min > target){
         min = target;
      }
      if(max < target){
        max = target;
      }
    }
    System.out.println((int)(max - min) );
  }
}
