import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    }
} Main public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    } solve {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N int a = 999999999; a 999999999 int b = 0; b 0 for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        } {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc a = Math.min(a, A[i]) a Math.min(a, A[i]) Math.min Math a A[i] A i b = Math.max(b, A[i]) b Math.max(b, A[i]) Math.max Math b A[i] A i System.out.println(b - a) System.out.println System.out System System.out b - a b a public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    }
} public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        int a = 999999999;
        int b = 0;
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            a = Math.min(a, A[i]);
            b = Math.max(b, A[i]);
        }
        System.out.println(b - a);
    }
}