import java.util.*;

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

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