import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for(int i=0; i<n; i++){
      int a = sc.nextInt();
      if(a>max){
        max = a;
      }
      if(a<min){
        min = a;
      }
    }

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

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

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

    int sub = max - min;
    System.out.println(sub);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE for(int i=0; i<n; i++){
      int a = sc.nextInt();
      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 = sc.nextInt();
      if(a>max){
        max = a;
      }
      if(a<min){
        min = a;
      }
    } {
      int a = sc.nextInt();
      if(a>max){
        max = a;
      }
      if(a<min){
        min = a;
      }
    } int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc 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 int sub = max - min; sub max - min max min System.out.println(sub) System.out.println System.out System System.out sub String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for(int i=0; i<n; i++){
      int a = sc.nextInt();
      if(a>max){
        max = a;
      }
      if(a<min){
        min = a;
      }
    }

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

    int sub = max - min;
    System.out.println(sub);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for(int i=0; i<n; i++){
      int a = sc.nextInt();
      if(a>max){
        max = a;
      }
      if(a<min){
        min = a;
      }
    }

    int sub = max - min;
    System.out.println(sub);
  }
}