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

public class Main {
	public static void main(String[] args) {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	} main {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	} Scanner  scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] input = new int[n]; input new int[n] n for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			input[i] = scan.nextInt();
		} {
			input[i] = scan.nextInt();
		} input[i] = scan.nextInt() input[i] input i scan.nextInt() scan.nextInt scan Arrays.sort(input) Arrays.sort Arrays input System.out.println(input[n - 1] - input[0]) System.out.println System.out System System.out input[n - 1] - input[0] input[n - 1] input n - 1 n 1 input[0] input 0 scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner  scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] input = new int[n];
		for(int i = 0; i < n; i++) {
			input[i] = scan.nextInt();
		}
		
		Arrays.sort(input);
		System.out.println(input[n - 1] - input[0]);
		scan.close();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

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