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