import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    }
} import java.util.Scanner; Scanner java.util public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    }
} Main static Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    } main {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    } int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan long first = scan.nextLong(); first scan.nextLong() scan.nextLong scan long max = first; max first long min = first; min first for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		} {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		} long a = scan.nextLong(); a scan.nextLong() scan.nextLong scan if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			} max < a max a {
				max = a;
			} max = a max a if(min > a) {
				min = a;
			} min > a min a {
				min = a;
			} min = a min a System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    }
} public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    }
} Main
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);

	public static void main(String[] args) {
		int n = scan.nextInt();

		long first = scan.nextLong();
		long max = first;
		long min = first;
		for(int i = 1; i < n; i++) {
			long a = scan.nextLong();
			if(max < a) {
				max = a;
			}else if(min > a) {
				min = a;
			}
		}

		System.out.println(max - min);
    }
}
