import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = 0; a 0 int maxNum = 1; maxNum 1 int minNum = Integer.MAX_VALUE; minNum Integer.MAX_VALUE Integer Integer.MAX_VALUE for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		} {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		} a = sc.nextInt() a sc.nextInt() sc.nextInt sc maxNum = Math.max(a, maxNum) maxNum Math.max(a, maxNum) Math.max Math a maxNum minNum = Math.min(a, minNum) minNum Math.min(a, minNum) Math.min Math a minNum System.out.println(maxNum - minNum) System.out.println System.out System System.out maxNum - minNum maxNum minNum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = 0;
		int maxNum = 1;
		int minNum = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) {
			a = sc.nextInt();
			maxNum = Math.max(a, maxNum);
			minNum = Math.min(a, minNum);
		}
		System.out.println(maxNum - minNum);
	}

}
