
import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;


class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        List<Integer> a = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }

        Collections.sort(a);

        System.out.println(a.get(N - 1) - a.get(0));

    }
}

 import java.lang.reflect.Array; Array java.lang.reflect import java.util.*; util.* java import java.lang.*; lang.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        List<Integer> a = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }

        Collections.sort(a);

        System.out.println(a.get(N - 1) - a.get(0));

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        List<Integer> a = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }

        Collections.sort(a);

        System.out.println(a.get(N - 1) - a.get(0));

    } main {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        List<Integer> a = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }

        Collections.sort(a);

        System.out.println(a.get(N - 1) - a.get(0));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc List<Integer> a = new ArrayList<>(); a new ArrayList<>() for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            a.add(sc.nextInt());
        } {
            a.add(sc.nextInt());
        } a.add(sc.nextInt()) a.add a sc.nextInt() sc.nextInt sc Collections.sort(a) Collections.sort Collections a System.out.println(a.get(N - 1) - a.get(0)) System.out.println System.out System System.out a.get(N - 1) - a.get(0) a.get(N - 1) a.get a N - 1 N 1 a.get(0) a.get a 0 String[] args args

import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;


class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        List<Integer> a = new ArrayList<>();

        for (int i = 0; i < N; i++) {
            a.add(sc.nextInt());
        }

        Collections.sort(a);

        System.out.println(a.get(N - 1) - a.get(0));

    }
}


