import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int min = 1000000000;
		for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		}
		System.out.print(max-min);
	}
} import java.util.*; util.* java class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int min = 1000000000;
		for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		}
		System.out.print(max-min);
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int min = 1000000000;
		for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		}
		System.out.print(max-min);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int min = 1000000000;
		for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		}
		System.out.print(max-min);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int max = 0; max 0 int min = 1000000000; min 1000000000 for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		} {
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		} int work = sc.nextInt(); work sc.nextInt() sc.nextInt sc max = Math.max(max,work) max Math.max(max,work) Math.max Math max work min = Math.min(min,work) min Math.min(min,work) Math.min Math min work System.out.print(max-min) System.out.print System.out System System.out max-min max min String args[] args
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int max = 0;
		int min = 1000000000;
		for(int i = 0; i < n; i++){
			int work = sc.nextInt();
			max = Math.max(max,work);
			min = Math.min(min,work);
		}
		System.out.print(max-min);
	}
}
