import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

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

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

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

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

} Main
import java.util.Scanner;
import java.util.Collections;
import java.util.ArrayList;

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

}