import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	} main {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

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

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n=scan.nextInt();
		int max=0;
		int min=2147483647;
		int a=0;
		for(int i=0;i<n;i++) {
			a=scan.nextInt();
			if(max<=a) {
				max=a;
			}
			if(min>=a){
				min=a;
			}
		}
		int result=max-min;

		System.out.println(result);
		scan.close();		

	}
}