import java.util.Scanner;

public class Main {

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

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