import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    }
} Main public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    } main {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int max = Integer.MIN_VALUE max Integer.MIN_VALUE Integer Integer.MIN_VALUE min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        } {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        } int temp = scanner.nextInt(); temp scanner.nextInt() scanner.nextInt scanner if (max < temp) max = temp; max < temp max temp max = temp max temp if (min > temp) min = temp; min > temp min temp min = temp min temp System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    }
} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;

        for (int i = 0; i < N; i++) {
            int temp = scanner.nextInt();
            if (max < temp) max = temp;
            if (min > temp) min = temp;
        }
        System.out.println(max - min);
    }
}
