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];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	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];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	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];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	System.out.println(max-min);
    } main {
	Scanner scan = new Scanner(System.in);

	int N = scan.nextInt();
	int[] A = new int[N];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	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 for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    A[i] = scan.nextInt();
	} {
	    A[i] = scan.nextInt();
	} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan int min = Integer.MAX_VALUE; min Integer.MAX_VALUE Integer Integer.MAX_VALUE int max = Integer.MIN_VALUE; max Integer.MIN_VALUE Integer Integer.MIN_VALUE for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	} {
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	} if(A[i] < min){
		min = A[i];
	    } A[i] < min A[i] A i min {
		min = A[i];
	    } min = A[i] min A[i] A i if(A[i] > max){
		max = A[i];
	    } A[i] > max A[i] A i max {
		max = A[i];
	    } max = A[i] max 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 scan = new Scanner(System.in);

	int N = scan.nextInt();
	int[] A = new int[N];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	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];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	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];

	for(int i = 0; i < N; i++){
	    A[i] = scan.nextInt();
	}

	int min = Integer.MAX_VALUE;
	int max = Integer.MIN_VALUE;

	for(int i = 0; i < N; i++){
	    if(A[i] < min){
		min = A[i];
	    }
	    if(A[i] > max){
		max = A[i];
	    }
	}

	System.out.println(max-min);
    }
}
