import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	}
} 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 max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = sc.nextInt(); max sc.nextInt() sc.nextInt sc int min = max; min max for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		} {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if (a > max)			max = a;
			else if (a < min)		min = a; a > max a max max = a max a if (a < min)		min = a; a < min a min min = a min a System.out.println(Math.abs(max - min)) System.out.println System.out System System.out Math.abs(max - min) Math.abs Math max - min max min String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		
		int max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	}
} 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 max = sc.nextInt();
		int min = max;
		
		for (int i = 1; i < n; i++) {
			int a = sc.nextInt();
			if (a > max)			max = a;
			else if (a < min)		min = a;
		}
		
		System.out.println(Math.abs(max - min));
	}
}