import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	}

} import java.util.*; util.* java public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int A[] = new int[N]; A new int[N] N int Max=0 Max 0 Min=Integer.MAX_VALUE; Min Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		} {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc if(A[i]>Max)Max=A[i]; A[i]>Max A[i] A i Max Max=A[i] Max A[i] A i if(A[i]<Min)Min=A[i]; A[i]<Min A[i] A i Min Min=A[i] Min A[i] A i System.out.println(Max-Min) System.out.println System.out System System.out Max-Min Max Min sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	}

} Main
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		int Max=0, Min=Integer.MAX_VALUE;
		for(int i = 0; i<N; i++) {
			A[i] = sc.nextInt();
			if(A[i]>Max)Max=A[i];
			if(A[i]<Min)Min=A[i];
		}
		System.out.println(Max-Min);
		sc.close();
	}

}