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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	} Scanner sc1 = new Scanner(System.in); sc1 new Scanner(System.in) int n = sc1.nextInt(); n sc1.nextInt() sc1.nextInt sc1 int[] a = new int[n]; a new int[n] n for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			a[i] = sc1.nextInt();
		} {
			a[i] = sc1.nextInt();
		} a[i] = sc1.nextInt() a[i] a i sc1.nextInt() sc1.nextInt sc1 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 int ans = max - min; ans max - min max min System.out.println(ans) System.out.println System.out System System.out ans sc1.close() sc1.close sc1 String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	}

} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];

		for ( int i = 0 ; i < n ; i++ ) {
			a[i] = sc1.nextInt();
		}

		Arrays.sort(a);

		int min = a[0];
		int max = a[n-1];

		int ans = max - min;

		System.out.println(ans);

		sc1.close();

	}

}