import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	} main {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int total = sc.nextInt(); total sc.nextInt() sc.nextInt sc int[] line = new int[total]; line new int[total] total for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i < total i total i++ i++ i {
			line[i] = sc.nextInt();
		} {
			line[i] = sc.nextInt();
		} line[i] = sc.nextInt() line[i] line i sc.nextInt() sc.nextInt sc Arrays.sort(line) Arrays.sort Arrays line int maxDiff = line[total-1] - line[0]; maxDiff line[total-1] - line[0] line[total-1] line total-1 total 1 line[0] line 0 System.out.println(maxDiff) System.out.println System.out System System.out maxDiff String[] args args public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	}
} public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int total = sc.nextInt();
		int[] line = new int[total];

		for(int i=0; i < total; i++) {
			line[i] = sc.nextInt();
		}

		Arrays.sort(line);
		int maxDiff = line[total-1] - line[0];

		System.out.println(maxDiff);
	}
}
