import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	}
} import java.util.Arrays; Arrays 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 = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc long[] a = new long[n]; a new long[n] n for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = Long.parseLong(sc.next());
		} {
			a[i] = Long.parseLong(sc.next());
		} a[i] = Long.parseLong(sc.next()) a[i] a i Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc Arrays.sort(a) Arrays.sort Arrays a System.out.println(a[a.length-1]-a[0]) System.out.println System.out System System.out a[a.length-1]-a[0] a[a.length-1] a a.length-1 a.length a a.length 1 a[0] a 0 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		long[] a = new long[n];
		
		for(int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sc.next());
		}
		
		Arrays.sort(a);
		
		System.out.println(a[a.length-1]-a[0]);
		
	}
}
