import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

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

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc List<Integer> A = new ArrayList<>(); A new ArrayList<>() for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A.add(sc.nextInt());
        } {
            A.add(sc.nextInt());
        } A.add(sc.nextInt()) A.add A sc.nextInt() sc.nextInt sc System.out.println(Math.abs(Collections.max(A) - Collections.min(A))) System.out.println System.out System System.out Math.abs(Collections.max(A) - Collections.min(A)) Math.abs Math Collections.max(A) - Collections.min(A) Collections.max(A) Collections.max Collections A Collections.min(A) Collections.min Collections A String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    }
}
