
import java.util.Scanner;

public class Main {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	}
} Main static Scanner in = new Scanner(System.in); in new Scanner(System.in) public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	} main {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	} int N = in.nextInt(); N in.nextInt() in.nextInt in long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE long max = Long.MIN_VALUE; max Long.MIN_VALUE Long Long.MIN_VALUE for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		} {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		} long A = in.nextLong(); A in.nextLong() in.nextLong in min = Long.min(min, A) min Long.min(min, A) Long.min Long min A max = Long.max(max, A) max Long.max(max, A) Long.max Long 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 {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	}
} public class Main {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	}
} Main

import java.util.Scanner;

public class Main {

	static Scanner in = new Scanner(System.in);

	public static void main(String[] args) {
		int N = in.nextInt();
		long min = Long.MAX_VALUE;
		long max = Long.MIN_VALUE;
		for (int i = 0; i < N; i++) {
			long A = in.nextLong();
			min = Long.min(min, A);
			max = Long.max(max, A);
		}
		System.out.println(max - min);
	}
}
