import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> numbers = new ArrayList<Integer>(); numbers new ArrayList<Integer>() for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			numbers.add(sc.nextInt());
		} {
			numbers.add(sc.nextInt());
		} numbers.add(sc.nextInt()) numbers.add numbers sc.nextInt() sc.nextInt sc Collections.sort(numbers) Collections.sort Collections numbers System.out.println(numbers.get(n-1) - numbers.get(0)) System.out.println System.out System System.out numbers.get(n-1) - numbers.get(0) numbers.get(n-1) numbers.get numbers n-1 n 1 numbers.get(0) numbers.get numbers 0 String[] args args public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	}
} public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
public class Main {

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> numbers = new ArrayList<Integer>();
		for(int i = 0; i < n; i++){
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers);
		System.out.println(numbers.get(n-1) - numbers.get(0));
	}
}
