import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	}
} import java.util.Collections; Collections java.util import java.util.LinkedList; LinkedList 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();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc LinkedList<Integer> A = new LinkedList<>(); A new LinkedList<>() for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int a = sc.nextInt();
			A.add(a);
		} {
			int a = sc.nextInt();
			A.add(a);
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc A.add(a) A.add A a Collections.sort(A) Collections.sort Collections A System.out.println(A.getLast() - A.getFirst()) System.out.println System.out System System.out A.getLast() - A.getFirst() A.getLast() A.getLast A A.getFirst() A.getFirst A String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	}
} Main
import java.util.Collections;
import java.util.LinkedList;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		LinkedList<Integer> A = new LinkedList<>();
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();
			A.add(a);
		}

		Collections.sort(A);

		System.out.println(A.getLast() - A.getFirst());
	}
}