import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List 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();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc List<Long> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(sc.nextLong());
        } {
            list.add(sc.nextLong());
        } list.add(sc.nextLong()) list.add list sc.nextLong() sc.nextLong sc long max = Collections.max(list); max Collections.max(list) Collections.max Collections list long min = Collections.min(list); min Collections.min(list) Collections.min Collections list 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) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    }
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(sc.nextLong());
        }
        long max = Collections.max(list);
        long min = Collections.min(list);
        System.out.println(max - min);
    }
}