
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((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[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((max-min));
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((max-min));
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((max-min));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A=new int[N]; A new int[N] N for(int i=0; i<N; i++) {A[i]=0;} int i=0; int i=0; i 0 i<N i N i++ i++ i {A[i]=0;} {A[i]=0;} A[i]=0 A[i] A i 0 for(int i=0; i<N; i++) {A[i]=sc.nextInt();} int i=0; int i=0; i 0 i<N i N i++ i++ i {A[i]=sc.nextInt();} {A[i]=sc.nextInt();} A[i]=sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc int max=0 max 0 min=-1; min -1 1 for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		} {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		} if(A[i]>max)max=A[i]; A[i]>max A[i] A i max max=A[i] max A[i] A i if(min==-1||A[i]<min)min=A[i]; min==-1||A[i]<min min==-1 min -1 1 A[i]<min A[i] A i min min=A[i] min A[i] A i 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 sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((max-min));
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((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[] A=new int[N];
		for(int i=0; i<N; i++) {A[i]=0;}
		for(int i=0; i<N; i++) {A[i]=sc.nextInt();}
		int max=0,min=-1;
		for(int i=0; i<N; i++) {
			if(A[i]>max)max=A[i];
			if(min==-1||A[i]<min)min=A[i];
		}
		System.out.println((max-min));
	}
}