import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	}
} import java.io.File; File java.io import java.io.IOException; IOException java.io import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Comparator; Comparator java.util import java.util.Deque; Deque java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	}
} Main public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	} main {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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] A i sc.nextInt() sc.nextInt sc int min = 1000000001; min 1000000001 int max = 0; max 0 for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} {
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		} if(A[i] < min) min = A[i]; A[i] < min A[i] A i min min = A[i] min A[i] A i if(A[i] > max) max = A[i]; A[i] > max A[i] A i max max = A[i] max A[i] A 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) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	}
} public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	}
} Main
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;

public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] A = new int[N];
		for(int i = 0; i < N; i++) A[i] = sc.nextInt();
		
		int min = 1000000001;
		int max = 0;
		
		for(int i = 0; i < N; i++){
			if(A[i] < min) min = A[i];
			if(A[i] > max) max = A[i];
		}
		
		System.out.println(max - min);
	}
}