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

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
} Main void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    } run {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)
            a[i] = scan.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = scan.nextInt(); a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan Arrays.sort(a) Arrays.sort Arrays a System.out.println(a[n - 1] - a[0]) System.out.println System.out System System.out a[n - 1] - a[0] a[n - 1] a n - 1 n 1 a[0] a 0 public static void main(String[] args) {
        new Main().run();
    } main {
        new Main().run();
    } new Main().run() new Main().run new Main() String[] args args public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
} public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    void run() {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = scan.nextInt();
        Arrays.sort(a);
        System.out.println(a[n - 1] - a[0]);
    }
    public static void main(String[] args) {
        new Main().run();
    }
}
