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) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
} 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) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		} {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner List<Integer> integers = new ArrayList<Integer>(); integers new ArrayList<Integer>() for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
				integers.add(scanner.nextInt());
			} {
				integers.add(scanner.nextInt());
			} integers.add(scanner.nextInt()) integers.add integers scanner.nextInt() scanner.nextInt scanner System.out.println(Collections.max(integers) - Collections.min(integers)) System.out.println System.out System System.out Collections.max(integers) - Collections.min(integers) Collections.max(integers) Collections.max Collections integers Collections.min(integers) Collections.min Collections integers String[] args args public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
} public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
} 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) {
		try (Scanner scanner = new Scanner(System.in)) {
			int N = scanner.nextInt();
			List<Integer> integers = new ArrayList<Integer>();
			for (int i = 0; i < N; i++) {
				integers.add(scanner.nextInt());
			}

			System.out.println(Collections.max(integers) - Collections.min(integers));
		}
	}
}