import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	} main {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int a1 = scanner.nextInt(); a1 scanner.nextInt() scanner.nextInt scanner int min = a1; min a1 int max = a1; max a1 for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		} {
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		} int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner min = Math.min(min, a) min Math.min(min, a) Math.min Math min a max = Math.max(max, a) max Math.max(max, a) Math.max Math max a System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int a1 = scanner.nextInt();
		int min = a1;
		int max = a1;
		for (int i=1; i<n; i++){
			int a = scanner.nextInt();
			min = Math.min(min, a);
			max = Math.max(max, a);
		}
		System.out.println(max-min);
	}
}