import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;


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

        }
        
        
        

		
	
} import java.awt.Point; Point java.awt import java.util.ArrayDeque; ArrayDeque java.util import java.util.Scanner; Scanner java.util import java.util.*; util.* java import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.util.Set; Set java.util import java.util.HashSet; HashSet java.util import java.util.Collection; Collection java.util public class Main{
	
        static final Scanner sc=new Scanner(System.in);
        
        
        
        
        
        
        public static void main(String[]args){
                int N=sc.nextInt();
                int[]A=new int[N];
                for(int i=0;i<N;i++){
                        A[i]=sc.nextInt();
                }
                int max=0;
                Arrays.sort(A);
                max=Math.abs(A[0]-A[N-1]);
                System.out.println(max);

        }
        
        
        

		
	
} Main static final Scanner sc=new Scanner(System.in); sc new Scanner(System.in) public static void main(String[]args){
                int N=sc.nextInt();
                int[]A=new int[N];
                for(int i=0;i<N;i++){
                        A[i]=sc.nextInt();
                }
                int max=0;
                Arrays.sort(A);
                max=Math.abs(A[0]-A[N-1]);
                System.out.println(max);

        } main {
                int N=sc.nextInt();
                int[]A=new int[N];
                for(int i=0;i<N;i++){
                        A[i]=sc.nextInt();
                }
                int max=0;
                Arrays.sort(A);
                max=Math.abs(A[0]-A[N-1]);
                System.out.println(max);

        } int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc int[]A=new int[N]; A new int[N] N 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 int max=0; max 0 Arrays.sort(A) Arrays.sort Arrays A max=Math.abs(A[0]-A[N-1]) max Math.abs(A[0]-A[N-1]) Math.abs Math A[0]-A[N-1] A[0] A 0 A[N-1] A N-1 N 1 System.out.println(max) System.out.println System.out System System.out max String[]args args public class Main{
	
        static final Scanner sc=new Scanner(System.in);
        
        
        
        
        
        
        public static void main(String[]args){
                int N=sc.nextInt();
                int[]A=new int[N];
                for(int i=0;i<N;i++){
                        A[i]=sc.nextInt();
                }
                int max=0;
                Arrays.sort(A);
                max=Math.abs(A[0]-A[N-1]);
                System.out.println(max);

        }
        
        
        

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

        }
        
        
        

		
	
} Main
import java.awt.Point;
import java.util.ArrayDeque;
import java.util.Scanner;
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;


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

        }
        
        
        

		
	
}
