import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		int max, min;
		max = min = a[0];
		for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		}

		int dif;
		dif = max - min;
		System.out.println(dif);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		int max, min;
		max = min = a[0];
		for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		}

		int dif;
		dif = max - min;
		System.out.println(dif);
	}
} Main public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		int max, min;
		max = min = a[0];
		for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		}

		int dif;
		dif = max - min;
		System.out.println(dif);
	} main {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		int max, min;
		max = min = a[0];
		for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		}

		int dif;
		dif = max - min;
		System.out.println(dif);
	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = stdIn.nextInt();
		} {
			a[i] = stdIn.nextInt();
		} a[i] = stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn int max max min; min max = min = a[0] max min = a[0] min a[0] a 0 for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		} {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		} if (max < a[j])
				max = a[j]; max < a[j] max a[j] a j max = a[j] max a[j] a j if (min > a[j])
				min = a[j]; min > a[j] min a[j] a j min = a[j] min a[j] a j int dif; dif dif = max - min dif max - min max min System.out.println(dif) System.out.println System.out System System.out dif String[] args args
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = stdIn.nextInt();
		}
		int max, min;
		max = min = a[0];
		for (int j = 0; j < n; j++) {
			if (max < a[j])
				max = a[j];
			if (min > a[j])
				min = a[j];
		}

		int dif;
		dif = max - min;
		System.out.println(dif);
	}
}