import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length ++i ++i i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc System.out.println(solve(A)) System.out.println System.out System System.out solve(A) solve A sc.close() sc.close sc String[] args args static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    } solve {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    } return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt(); Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt() Arrays.stream(A).max().getAsInt() Arrays.stream(A).max().getAsInt Arrays.stream(A).max() Arrays.stream(A).max Arrays.stream(A) Arrays.stream Arrays A Arrays.stream(A).min().getAsInt() Arrays.stream(A).min().getAsInt Arrays.stream(A).min() Arrays.stream(A).min Arrays.stream(A) Arrays.stream Arrays A int[] A A public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < A.length; ++i) {
            A[i] = sc.nextInt();
        }

        System.out.println(solve(A));

        sc.close();
    }

    static int solve(int[] A) {
        return Arrays.stream(A).max().getAsInt() - Arrays.stream(A).min().getAsInt();
    }
}