import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		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 long max = Long.MIN_VALUE; max Long.MIN_VALUE Long Long.MIN_VALUE long min = Long.MAX_VALUE; min Long.MAX_VALUE Long Long.MAX_VALUE for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		} {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		} long temp = sc.nextLong(); temp sc.nextLong() sc.nextLong sc if (temp>max) {
				max = temp;
			} temp>max temp max {
				max = temp;
			} max = temp max temp if (temp<min) {
				min = temp;
			} temp<min temp min {
				min = temp;
			} min = temp min temp System.out.println(max-min) System.out.println System.out System System.out max-min max min String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i=0;i<N;i++) {
			long temp = sc.nextLong();
			if (temp>max) {
				max = temp;
			}
			if (temp<min) {
				min = temp;
			}
		}
		System.out.println(max-min);
	}
}