import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    } main {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int num = in.nextInt(); num in.nextInt() in.nextInt in int max = -1; max -1 1 int min = -1; min -1 1 for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        } {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        } int tmp = in.nextInt(); tmp in.nextInt() in.nextInt in max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max max max < 0 ? tmp
                    : max < tmp ? tmp
                    : max max < 0 max 0 tmp max < tmp ? tmp
                    : max max < tmp max tmp tmp max min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min min min < 0 ? tmp
                    : min > tmp ? tmp
                    : min min < 0 min 0 tmp min > tmp ? tmp
                    : min min > tmp min tmp tmp min int ans = max - min; ans max - min max min System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int max = -1;
        int min = -1;

        for (int i = 0; i < num; i++) {
            int tmp = in.nextInt();
            max = max < 0 ? tmp
                    : max < tmp ? tmp
                    : max;
            min = min < 0 ? tmp
                    : min > tmp ? tmp
                    : min;
        }
        int ans = max - min;
        System.out.println(ans);
    }
}
