import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  } main {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int max = 1; max 1 int min = 1000000000; min 1000000000 int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    } sc.hasNext() sc.hasNext sc { 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    } int val = sc.nextInt(); val sc.nextInt() sc.nextInt sc max = Math.max(max,val) max Math.max(max,val) Math.max Math max val min = Math.min(min,val) min Math.min(min,val) Math.min Math min val System.out.println(Math.abs(max-min)) System.out.println System.out System System.out Math.abs(max-min) Math.abs Math max-min max min String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int max = 1;
    int min = 1000000000;
    int N = sc.nextInt();
    while (sc.hasNext()){ 
        int val = sc.nextInt();
        max = Math.max(max,val);
        min = Math.min(min,val);
    }
    System.out.println(Math.abs(max-min));
  }
}