import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  } main {
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> ar = new ArrayList<Integer>(); ar new ArrayList<Integer>() int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    } int i=0; int i=0; i 0 i<N i N i++ i++ i {
      int A = sc.nextInt();
      ar.add(A);
    } {
      int A = sc.nextInt();
      ar.add(A);
    } int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc ar.add(A) ar.add ar A Collections.sort(ar) Collections.sort Collections ar System.out.println(Math.abs(ar.get(0)-ar.get(N-1))) System.out.println System.out System System.out Math.abs(ar.get(0)-ar.get(N-1)) Math.abs Math ar.get(0)-ar.get(N-1) ar.get(0) ar.get ar 0 ar.get(N-1) ar.get ar N-1 N 1 String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> ar = new ArrayList<Integer>();
    int N = sc.nextInt();
    for(int i=0;i<N;i++){
      int A = sc.nextInt();
      ar.add(A);
    }
    Collections.sort(ar);
    System.out.println(Math.abs(ar.get(0)-ar.get(N-1)));
  }
}
