import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	}
} import java.util.*; util.* java public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int max = 0 max 0 min = 1000000000; min 1000000000 for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		} int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		} {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		} int d = in.nextInt(); d in.nextInt() in.nextInt in max = Math.max(max, d) max Math.max(max, d) Math.max Math max d min = Math.min(min, d) min Math.min(min, d) Math.min Math min d System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int max = 0,min = 1000000000;
		for(int i = 0;i < n;i ++) {
			int d = in.nextInt();
			max = Math.max(max, d);
			min = Math.min(min, d);
		}
		System.out.println(max - min);
	}
} Main
import java.util.*;

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