import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	}
} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	} main {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	} try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		} {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String a = sc.nextLine(); a sc.nextLine() sc.nextLine sc String[] b = a.split(" "); b a.split(" ") a.split a " " List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			} int i = 0; int i = 0; i 0 i < b.length i b.length b b.length i++ i++ i {
				list.add(Integer.parseInt(b[i]));
			} {
				list.add(Integer.parseInt(b[i]));
			} list.add(Integer.parseInt(b[i])) list.add list Integer.parseInt(b[i]) Integer.parseInt Integer b[i] b i Collections.sort(list) Collections.sort Collections list System.out.println(list.get(list.size() - 1) - list.get(0)) System.out.println System.out System System.out list.get(list.size() - 1) - list.get(0) list.get(list.size() - 1) list.get list list.size() - 1 list.size() list.size list 1 list.get(0) list.get list 0 String[] args args public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	}
} public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	}
} Main
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {
			int n = Integer.parseInt(sc.nextLine());
			String a = sc.nextLine();
			String[] b = a.split(" ");
			List<Integer> list = new ArrayList<>();

			for (int i = 0; i < b.length; i++) {
				list.add(Integer.parseInt(b[i]));
			}

			Collections.sort(list);

			System.out.println(list.get(list.size() - 1) - list.get(0));
		}
	}
}
