import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
	long a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	}public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
	public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}

public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
} 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 a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	}public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
	public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}

public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
	long a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	} main {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
	long a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long a[]=new long[n]; a new long[n] n for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
} int i=0; int i=0; i 0 i<=n-1 i n-1 n 1 i++ i++ i {
	a[i]=sc.nextLong();
} {
	a[i]=sc.nextLong();
} a[i]=sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc System.out.println(haimax(a)-haimin(a)) System.out.println System.out System System.out haimax(a)-haimin(a) haimax(a) haimax a haimin(a) haimin a String[] args args public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	} haimax {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	} int d; d d = a[0] d a[0] a 0 for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		} int i = 0; int i = 0; i 0 i <= a.length - 1 i a.length - 1 a.length a a.length 1 i++ i++ i {
			if (d <= a[i]) {
				d = a[i];
			}

		} {
			if (d <= a[i]) {
				d = a[i];
			}

		} if (d <= a[i]) {
				d = a[i];
			} d <= a[i] d a[i] a i {
				d = a[i];
			} d = a[i] d a[i] a i return d; d int a[] a public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	} haimax {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	} long d; d d = a[0] d a[0] a 0 for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		} int i = 0; int i = 0; i 0 i <= a.length - 1 i a.length - 1 a.length a a.length 1 i++ i++ i {
			if (d <= a[i]) {
				d = a[i];
			}

		} {
			if (d <= a[i]) {
				d = a[i];
			}

		} if (d <= a[i]) {
				d = a[i];
			} d <= a[i] d a[i] a i {
				d = a[i];
			} d = a[i] d a[i] a i return d; d long a[] a public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	} haimin {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	} long d; d d = a[0] d a[0] a 0 for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		} int i = 0; int i = 0; i 0 i <= a.length - 1 i a.length - 1 a.length a a.length 1 i++ i++ i {
			if (d >= a[i]) {
				d = a[i];
			}

		} {
			if (d >= a[i]) {
				d = a[i];
			}

		} if (d >= a[i]) {
				d = a[i];
			} d >= a[i] d a[i] a i {
				d = a[i];
			} d = a[i] d a[i] a i return d; d long a[] a public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
	long a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	}public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
	public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}

public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
	long a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	}public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
	public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}

public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
} 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 a[]=new long[n];
for(int i=0;i<=n-1;i++){
	a[i]=sc.nextLong();
}
System.out.println(haimax(a)-haimin(a));
	}public static int haimax(int a[]) {
		int d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
	public static long haimax(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d <= a[i]) {
				d = a[i];
			}

		}
		return d;
	}

public static long haimin(long a[]) {
		long d;
		d = a[0];
		for (int i = 0; i <= a.length - 1; i++) {
			if (d >= a[i]) {
				d = a[i];
			}

		}
		return d;
	}
}