import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

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

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

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

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            min = Math.min(min, a);
            max = Math.max(max, a);
        }
        System.out.println(max - min);
    }
} Main
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int min = Integer.MAX_VALUE, max = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            min = Math.min(min, a);
            max = Math.max(max, a);
        }
        System.out.println(max - min);
    }
}