import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
}
} Main public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
} main {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int a=scan.nextInt(); a scan.nextInt() scan.nextInt scan int b[]=new int[a]; b new int[a] a for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	} int i=0; int i=0; i 0 i<a i a i++ i++ i {
		b[i]=scan.nextInt();
	} {
		b[i]=scan.nextInt();
	} b[i]=scan.nextInt() b[i] b i scan.nextInt() scan.nextInt scan Arrays.sort(b) Arrays.sort Arrays b System.out.println(b[a-1]-b[0]) System.out.println System.out System System.out b[a-1]-b[0] b[a-1] b a-1 a 1 b[0] b 0 String[]srgs srgs public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
}
} public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
}
} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b[]=new int[a];
	for(int i=0;i<a;i++) {
		b[i]=scan.nextInt();
	}
	Arrays.sort(b);
	System.out.println(b[a-1]-b[0]);
}
}