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