import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  }
} Main public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  } main {
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = Integer.parseInt(sc.next()); N Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int max = 0 max 0 min = 1000000000; min 1000000000 for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    } {
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    } int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc max = n > max ? n : max max n > max ? n : max n > max n max n max min = n < min ? n : min min n < min ? n : min n < min n min n min System.out.println(max - min) System.out.println System.out System System.out max - min max min String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    int N = Integer.parseInt(sc.next());
    
    int max = 0, min = 1000000000;
    for(int i = 0; i < N; i++){
      int n = Integer.parseInt(sc.next());
      max = n > max ? n : max;
      min = n < min ? n : min;
    }
    
    System.out.println(max - min);
  }
}