import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	}
	
	public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	}
	
	public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in long[] ary = new long[n]; ary new long[n] n for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			ary[i] = in.nextInt();
		} {
			ary[i] = in.nextInt();
		} ary[i] = in.nextInt() ary[i] ary i in.nextInt() in.nextInt in Arrays.sort(ary) Arrays.sort Arrays ary solve(ary[0], ary[n-1]) solve ary[0] ary 0 ary[n-1] ary n-1 n 1 String[] args args public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	} solve {
		System.out.println(Math.abs(a-b));
	} System.out.println(Math.abs(a-b)) System.out.println System.out System System.out Math.abs(a-b) Math.abs Math a-b a b long a a long b b public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	}
	
	public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	}
	
	public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] ary = new long[n];
		
		for ( int i = 0; i < n; i++ ) {
			ary[i] = in.nextInt();
		}
		
		Arrays.sort(ary);
		solve(ary[0], ary[n-1]);
	}
	
	public static void solve(long a, long b) {
		System.out.println(Math.abs(a-b));
	}
}