import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(input.readLine()); n Integer.parseInt(input.readLine()) Integer.parseInt Integer input.readLine() input.readLine input StringTokenizer tokn = new StringTokenizer(input.readLine()); tokn new StringTokenizer(input.readLine()) int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = -1; max -1 1 for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        } {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        } int value = Integer.parseInt(tokn.nextToken()); value Integer.parseInt(tokn.nextToken()) Integer.parseInt Integer tokn.nextToken() tokn.nextToken tokn if (value < min) {
                min = value;
            } value < min value min {
                min = value;
            } min = value min value if (value > max) {
                max = value;
            } value > max value max {
                max = value;
            } max = value max value 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) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(input.readLine());
        StringTokenizer tokn = new StringTokenizer(input.readLine());

        int min = Integer.MAX_VALUE;
        int max = -1;

        for (int i = 0; i < n; i++) {
            int value = Integer.parseInt(tokn.nextToken());
            if (value < min) {
                min = value;
            }
            if (value > max) {
                max = value;
            }
        }
        System.out.println(max - min);
    }
}
