
    import java.util.*;
    public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    } import java.util.*; util.* java public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    } Main public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	} main {
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int numM = scan.nextInt(); numM scan.nextInt() scan.nextInt scan int[] numArray = new int[numM]; numArray new int[numM] numM int min; min int max; max for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < numM i numM i++ i++ i {
		    numArray[i] = scan.nextInt();
		} {
		    numArray[i] = scan.nextInt();
		} numArray[i] = scan.nextInt() numArray[i] numArray i scan.nextInt() scan.nextInt scan min = numArray[0] min numArray[0] numArray 0 max = numArray[0] max numArray[0] numArray 0 for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		} int i =1; int i =1; i 1 i <numM i numM i++ i++ i {
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		} {
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		} if(min > numArray[i]){
			    min = numArray[i];
			} min > numArray[i] min numArray[i] numArray i {
			    min = numArray[i];
			} min = numArray[i] min numArray[i] numArray i if(max < numArray[i]){
			    max = numArray[i];
			} max < numArray[i] max numArray[i] numArray i {
			    max = numArray[i];
			} max = numArray[i] max numArray[i] numArray 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 scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    } public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    } Main

    import java.util.*;
    public class Main{
	public static void main(String[] args){
	    Scanner scan = new Scanner(System.in);
	    
	    int numM = scan.nextInt();
	    int[] numArray = new int[numM]; 
	    int min;
	    int max;
		for(int i = 0; i < numM;i++){
		    numArray[i] = scan.nextInt();
		}
		min = numArray[0];
		max = numArray[0];
		for(int i =1; i <numM; i++){
		    
			if(min > numArray[i]){
			    min = numArray[i];
			}
			if(max < numArray[i]){
			    max = numArray[i];
			}
		    
		}
		System.out.println(max-min);
		
	    
	   
	}
    }
