import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    }
} Main public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    } main {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] array = new int[N]; array new int[N] N for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
		    array[i] = sc.nextInt();
		} {
		    array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc Arrays.sort(array) Arrays.sort Arrays array System.out.println(array[N-1]-array[0]) System.out.println System.out System System.out array[N-1]-array[0] array[N-1] array N-1 N 1 array[0] array 0 String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
    	Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] array = new int[N];
		
		for(int i=0;i<N;i++){
		    array[i] = sc.nextInt();
		}
		
		Arrays.sort(array);
		
		System.out.println(array[N-1]-array[0]);
	    
    }
}
