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

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	}
} 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 scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) Integer N = new Integer(scanner.next()); N new Integer(scanner.next()) ArrayList<Integer> input = new ArrayList<Integer>(); input new ArrayList<Integer>() for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			input.add(new Integer(scanner.next()));
		} {
			input.add(new Integer(scanner.next()));
		} input.add(new Integer(scanner.next())) input.add input new Integer(scanner.next()) Integer max = Collections.max(input); max Collections.max(input) Collections.max Collections input Integer min = Collections.min(input); min Collections.min(input) Collections.min Collections input String output = String.valueOf((max-min)); output String.valueOf((max-min)) String.valueOf String (max-min) max min System.out.println(output) System.out.println System.out System System.out output scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Integer N = new Integer(scanner.next());

		ArrayList<Integer> input = new ArrayList<Integer>();
		for(int i = 0;i<N;i++) {
			input.add(new Integer(scanner.next()));
		}

		Integer max = Collections.max(input);
		Integer min = Collections.min(input);
		String output = String.valueOf((max-min));

		System.out.println(output);

		scanner.close();
	}
}
