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) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	}

} 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) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = Integer.parseInt(in.nextLine()); n Integer.parseInt(in.nextLine()) Integer.parseInt Integer in.nextLine() in.nextLine in String[] tokens = in.nextLine().split(" "); tokens in.nextLine().split(" ") in.nextLine().split in.nextLine() in.nextLine in " " List<Integer> nums = new ArrayList<>(n); nums new ArrayList<>(n) for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			nums.add(Integer.parseInt(tokens[i]));
		} {
			nums.add(Integer.parseInt(tokens[i]));
		} nums.add(Integer.parseInt(tokens[i])) nums.add nums Integer.parseInt(tokens[i]) Integer.parseInt Integer tokens[i] tokens i Collections.sort(nums) Collections.sort Collections nums System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0))) System.out.println System.out System System.out Math.abs(nums.get(nums.size() - 1) - nums.get(0)) Math.abs Math nums.get(nums.size() - 1) - nums.get(0) nums.get(nums.size() - 1) nums.get nums nums.size() - 1 nums.size() nums.size nums 1 nums.get(0) nums.get nums 0 in.close() in.close in String[] args args public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	}

} Main
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) {
		Scanner in = new Scanner(System.in);
		int n = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		List<Integer> nums = new ArrayList<>(n);
		for (int i = 0; i < n; ++i) {
			nums.add(Integer.parseInt(tokens[i]));
		}
		Collections.sort(nums);
		System.out.println(Math.abs(nums.get(nums.size() - 1) - nums.get(0)));

		in.close();
	}

}
