import java.util.*;
import java.util.ArrayList;
import java.util.List;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  }
} import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  } main {
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Double> list = new ArrayList<>(); list new ArrayList<>() Double n = sc.nextDouble(); n sc.nextDouble() sc.nextDouble sc for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      list.add(sc.nextDouble());
    } {
      list.add(sc.nextDouble());
    } list.add(sc.nextDouble()) list.add list sc.nextDouble() sc.nextDouble sc Collections.sort(list) Collections.sort Collections list System.out.println((int)(list.get(list.size() - 1) - list.get(0))) System.out.println System.out System System.out (int)(list.get(list.size() - 1) - list.get(0)) list.get(list.size() - 1) list.get list list.size() - 1 list.size() list.size list 1 list.get(0) list.get list 0 return; String[] args args public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  }
} Main
import java.util.*;
import java.util.ArrayList;
import java.util.List;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    List<Double> list = new ArrayList<>();
    Double n = sc.nextDouble();
    for(int i = 0; i < n; i++){
      list.add(sc.nextDouble());
    }
    
    Collections.sort(list);
    System.out.println((int)(list.get(list.size() - 1) - list.get(0)));
    return;
  }
}
