import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	} main {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int Max = 1 Max 1 Min = 1000000000; Min 1000000000 for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		} int n = 0; int n = 0; n 0 n < N n N n++ n++ n {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		} {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		} int A = scanner.nextInt(); A scanner.nextInt() scanner.nextInt scanner Max = Math.max(Max, A) Max Math.max(Max, A) Math.max Math Max A Min = Math.min(Min, A) Min Math.min(Min, A) Math.min Math Min A scanner.close() scanner.close scanner int A = Max - Min; A Max - Min Max Min System.out.println(A) System.out.println System.out System System.out A String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Max = 1, Min = 1000000000;

		for (int n = 0; n < N; n++) {
			int A = scanner.nextInt();
			Max = Math.max(Max, A);
			Min = Math.min(Min, A);
		}
		scanner.close();
		int A = Max - Min;
		System.out.println(A);

	}
}