import java.util.Scanner;
import java.lang.Math;

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=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
} import java.util.Scanner; Scanner java.util import java.lang.Math; Math java.lang 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=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int []A=new int[N];
			int max=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		} main {
		Scanner sc = new Scanner(System.in);
		
			int N =sc.nextInt();		
			int []A=new int[N];
			int max=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		} 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=-100; max -100 100 int min=1000000000; min 1000000000 for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {
				A[i]=sc.nextInt();
			} {
				A[i]=sc.nextInt();
			} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			} int i=0; int i=0; i 0 i<N i N i++ i++ i {
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			} {
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			} min=Math.min(min,A[i]) min Math.min(min,A[i]) Math.min Math min A[i] A i max=Math.max(max,A[i]) max Math.max(max,A[i]) Math.max Math 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);
		
			int N =sc.nextInt();		
			int []A=new int[N];
			int max=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
} 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=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
} Main
import java.util.Scanner;
import java.lang.Math;

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=-100;
			int min=1000000000;
						
			for(int i=0;i<N;i++){
				A[i]=sc.nextInt();
			}
			for(int i=0;i<N;i++){
				min=Math.min(min,A[i]);
				max=Math.max(max,A[i]);
			}
			System.out.println(max-min);
		}
}