import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

		sc.close();
	}
} 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();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

		sc.close();
	} main {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		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 = (int) Math.pow(10, 9) min (int) Math.pow(10, 9) Math.pow Math 10 9 max = 0; max 0 for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		} {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		} int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc if (max < x) {
				max = x;
			} max < x max x {
				max = x;
			} max = x max x if (x < min) {
				min = x;
			} x < min x min {
				min = x;
			} min = x min x 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) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner((System.in));
		int n = sc.nextInt();
		int min = (int) Math.pow(10, 9), max = 0;

		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if (max < x) {
				max = x;
			}
			if (x < min) {
				min = x;
			}
		}
		
		System.out.println((max - min));

		sc.close();
	}
}
