import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	} main {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] = new int[N]; A new int[N] N int min = 1000000000; min 1000000000 int max = 0; max 0 for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc if(A[i] < min) min = A[i]; A[i] < min A[i] A i min min = A[i] min A[i] A i if(A[i] > max) max = A[i]; A[i] > max A[i] A i max max = A[i] max A[i] A i System.out.println(max - min) System.out.println System.out System System.out max - min max min String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		final int N = sc.nextInt();
		int A[] = new int[N];
		int min = 1000000000;
		int max = 0;
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		System.out.println(max - min);
	}
}
