import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	}
} Main public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int min = 1_000_000_000; min 1_000_000_000 int max = 1; max 1 for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		} {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		} int tmp = sc.nextInt(); tmp sc.nextInt() sc.nextInt sc if (tmp < min)
				min = tmp; tmp < min tmp min min = tmp min tmp if (tmp > max)
				max = tmp; tmp > max tmp max max = tmp max tmp System.out.println(max - min) System.out.println System.out System System.out max - min max min sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	}
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int min = 1_000_000_000;
		int max = 1;

		for (int i = 0; i < n; i++) {
			int tmp = sc.nextInt();
			if (tmp < min)
				min = tmp;
			if (tmp > max)
				max = tmp;
		}

		System.out.println(max - min);

		sc.close();
	}
}
