import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	} main {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int min = (int)Math.pow(10, 9); min (int)Math.pow(10, 9) Math.pow Math 10 9 int max = 0; max 0 for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		} {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		} int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner if(a > max) max = a; a > max a max max = a max a if(a < min) min = a; a < min a min min = a min a 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) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int min = (int)Math.pow(10, 9);
		int max = 0;
		for(int i = 0; i < n; i++) {
		int a = scanner.nextInt();
		if(a > max) max = a;
		if(a < min) min = a;
		}
		System.out.println(max-min);
	}

}