import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] numbers = new int[N];
		
		for(int j = 0; j  <numbers.length; j++) {
			numbers[j] = sc.nextInt();
		}
		
		int max = numbers[0];
		int min = numbers[0];
		
		for(int i = 1; i < numbers.length; i++ ) {
			if(numbers[i] > max ) {
				max = numbers[i];
			}
			if(numbers[i] < min ) {
				min = numbers[i];
			}
		}
		System.out.println(max-min);
	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] numbers = new int[N];
		
		for(int j = 0; j  <numbers.length; j++) {
			numbers[j] = sc.nextInt();
		}
		
		int max = numbers[0];
		int min = numbers[0];
		
		for(int i = 1; i < numbers.length; i++ ) {
			if(numbers[i] > max ) {
				max = numbers[i];
			}
			if(numbers[i] < min ) {
				min = numbers[i];
			}
		}
		System.out.println(max-min);
	}

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

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] numbers = new int[N];
		
		for(int j = 0; j  <numbers.length; j++) {
			numbers[j] = sc.nextInt();
		}
		
		int max = numbers[0];
		int min = numbers[0];
		
		for(int i = 1; i < numbers.length; i++ ) {
			if(numbers[i] > max ) {
				max = numbers[i];
			}
			if(numbers[i] < min ) {
				min = numbers[i];
			}
		}
		System.out.println(max-min);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] numbers = new int[N];
		
		for(int j = 0; j  <numbers.length; j++) {
			numbers[j] = sc.nextInt();
		}
		
		int max = numbers[0];
		int min = numbers[0];
		
		for(int i = 1; i < numbers.length; i++ ) {
			if(numbers[i] > max ) {
				max = numbers[i];
			}
			if(numbers[i] < min ) {
				min = numbers[i];
			}
		}
		System.out.println(max-min);
	}

}
