import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
       	int ary[] = new int[num];
      
      	for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        }
      	
      	Arrays.sort(ary);
     	int ans = ary[num-1] - ary[0];
      	System.out.println(ans);
      
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
       	int ary[] = new int[num];
      
      	for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        }
      	
      	Arrays.sort(ary);
     	int ans = ary[num-1] - ary[0];
      	System.out.println(ans);
      
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
       	int ary[] = new int[num];
      
      	for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        }
      	
      	Arrays.sort(ary);
     	int ans = ary[num-1] - ary[0];
      	System.out.println(ans);
      
    } main {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
       	int ary[] = new int[num];
      
      	for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        }
      	
      	Arrays.sort(ary);
     	int ans = ary[num-1] - ary[0];
      	System.out.println(ans);
      
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc int ary[] = new int[num]; ary new int[num] num for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
        	ary[i] = sc.nextInt();
        
        } {
        	ary[i] = sc.nextInt();
        
        } ary[i] = sc.nextInt() ary[i] ary i sc.nextInt() sc.nextInt sc Arrays.sort(ary) Arrays.sort Arrays ary int ans = ary[num-1] - ary[0]; ans ary[num-1] - ary[0] ary[num-1] ary num-1 num 1 ary[0] ary 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
       	int ary[] = new int[num];
      
      	for(int i = 0; i < num; i++)
        {
        	ary[i] = sc.nextInt();
        
        }
      	
      	Arrays.sort(ary);
     	int ans = ary[num-1] - ary[0];
      	System.out.println(ans);
      
    }
}