import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections 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 n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc ArrayList<Integer> nList = new ArrayList<>(); nList new ArrayList<>() for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		} int index = 1; int index = 1; index 1 index <= n index n index++ index++ index {
			int m = sc.nextInt();
			nList.add(m);
		} {
			int m = sc.nextInt();
			nList.add(m);
		} int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc nList.add(m) nList.add nList m Collections.sort(nList) Collections.sort Collections nList int x = nList.get(0); x nList.get(0) nList.get nList 0 int y = nList.get(nList.size() - 1); y nList.get(nList.size() - 1) nList.get nList nList.size() - 1 nList.size() nList.size nList 1 int z = y - x; z y - x y x System.out.println(z) System.out.println System.out System System.out z String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> nList = new ArrayList<>();

		for (int index = 1; index <= n; index++) {
			int m = sc.nextInt();
			nList.add(m);
		}
		Collections.sort(nList);
		int x = nList.get(0);
		int y = nList.get(nList.size() - 1);
		int z = y - x;
		System.out.println(z);
	}
}