import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(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();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(max-min);




	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(max-min);




	} main {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(max-min);




	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int max=sc.nextInt(); max sc.nextInt() sc.nextInt sc int min=max; min max int ichiji; ichiji for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		} {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		} ichiji=sc.nextInt() ichiji sc.nextInt() sc.nextInt sc if(max<ichiji)
				max=ichiji; max<ichiji max ichiji max=ichiji max ichiji if(min>ichiji)
				min=ichiji; min>ichiji min ichiji min=ichiji min ichiji System.out.print(max-min) System.out.print 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();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(max-min);




	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(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();
		int max=sc.nextInt();
		int min=max;
		int ichiji;
		for(int i=1;i<n;i++) {
			ichiji=sc.nextInt();
			if(max<ichiji)
				max=ichiji;
			if(min>ichiji)
				min=ichiji;
		}

		System.out.print(max-min);




	}

}
