import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

        System.out.println(Math.abs(max - min));
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

        System.out.println(Math.abs(max - min));
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

        System.out.println(Math.abs(max - min));
    } main {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

        System.out.println(Math.abs(max - min));
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int N = in.nextInt(); N in.nextInt() in.nextInt in int  min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        } int i = 0; int i = 0; i 0 i < N i N ++i ++i i {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        } {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        } int x = in.nextInt(); x in.nextInt() in.nextInt in min = Math.min(min, x) min Math.min(min, x) Math.min Math min x max = Math.max(max, x) max Math.max(max, x) Math.max Math max x 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 in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

        System.out.println(Math.abs(max - min));
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        int  min = Integer.MAX_VALUE;
        int max = Integer.MIN_VALUE;

        for (int i = 0; i < N; ++i) {
            int x = in.nextInt();
            min = Math.min(min, x);
            max = Math.max(max, x);
        }

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