import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		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 max = 0; max 0 int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		} {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		} int input = sc.nextInt(); input sc.nextInt() sc.nextInt sc if (input > max)
				max = input; input > max input max max = input max input if (input < min)
				min = input; input < min input min min = input min input 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 Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int max = 0;
		int min = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			int input = sc.nextInt();
			if (input > max)
				max = input;
			if (input < min)
				min = input;

		}
		System.out.println(max - min);
		sc.close();
	}
}