import java.util.Scanner;

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

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