import java.util.Arrays;
import java.util.Scanner;

class Main{

	static char[][] map;
	static int H;
	static int W;

	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		int min = a[0];
		int max = a[N-1];
		
		
			System.out.println(max-min);

		
		



	}
}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main{

	static char[][] map;
	static int H;
	static int W;

	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		int min = a[0];
		int max = a[N-1];
		
		
			System.out.println(max-min);

		
		



	}
} Main static char[][] map; map static int H; H static int W; W public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		int min = a[0];
		int max = a[N-1];
		
		
			System.out.println(max-min);

		
		



	} main {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		int min = a[0];
		int max = a[N-1];
		
		
			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] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc Arrays.sort(a) Arrays.sort Arrays a int min = a[0]; min a[0] a 0 int max = a[N-1]; max a[N-1] a N-1 N 1 System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
} Pair String from; from int end; end @Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} compareTo {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	} Pair otherpair = (Pair)other; otherpair (Pair)other return end - otherpair.end; end - otherpair.end end otherpair.end otherpair otherpair.end Object other other Comparable
import java.util.Arrays;
import java.util.Scanner;

class Main{

	static char[][] map;
	static int H;
	static int W;

	public static void main(String[] args) {



		Scanner sc = new Scanner(System.in);			//文字の入力
		//int N =sc.nextInt();
		int N =sc.nextInt();
		int[] a = new int[N];
		for(int i = 0;i < N;i++){
			a[i] = sc.nextInt();
		}
		
		Arrays.sort(a);
		int min = a[0];
		int max = a[N-1];
		
		
			System.out.println(max-min);

		
		



	}
}




class Pair implements Comparable{
	String from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



