import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
} Main public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	} main {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	} Scanner scnr = new Scanner(System.in); scnr new Scanner(System.in) int n = scnr.nextInt(); n scnr.nextInt() scnr.nextInt scnr int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		} {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		} int num = scnr.nextInt(); num scnr.nextInt() scnr.nextInt scnr if (num > max) {
				max = num;
			} num > max num max {
				max = num;
			} max = num max num if (num < min) {
				min = num;
			} num < min num min {
				min = num;
			} min = num min num 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 scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scnr = new Scanner(System.in);
		int n = scnr.nextInt();
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		for(int i = 0; i < n; i++) {
			int num = scnr.nextInt();
			if (num > max) {
				max = num;
			}
			if (num < min) {
				min = num;
			}
		}
		System.out.println(max - min);
	}
}