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