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

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