import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int arr[] = new int[N];
		int min=-1,max=-1;
		for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		}

		System.out.println(max-min);

	}
} import java.util.*; util.* java class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int arr[] = new int[N];
		int min=-1,max=-1;
		for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		}

		System.out.println(max-min);

	}
} Main public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int arr[] = new int[N];
		int min=-1,max=-1;
		for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		}

		System.out.println(max-min);

	} main {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int arr[] = new int[N];
		int min=-1,max=-1;
		for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		}

		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 arr[] = new int[N]; arr new int[N] N int min=-1 min -1 1 max=-1; max -1 1 for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		} int n=0; int n=0; n 0 n<N n N n++ n++ n {
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		} {
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		} arr[n] = sc.nextInt() arr[n] arr n sc.nextInt() sc.nextInt sc if(min==-1){
				min = arr[n];
				max = arr[n];
			} min==-1 min -1 1 {
				min = arr[n];
				max = arr[n];
			} min = arr[n] min arr[n] arr n max = arr[n] max arr[n] arr n if(min > arr[n]) min = arr[n]; min > arr[n] min arr[n] arr n min = arr[n] min arr[n] arr n if(max < arr[n]) max = arr[n]; max < arr[n] max arr[n] arr n max = arr[n] max arr[n] arr n System.out.println(max-min) System.out.println System.out System System.out max-min max min String args[] args
import java.util.*;

class Main{
	
	public static void main(String args[]){

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int arr[] = new int[N];
		int min=-1,max=-1;
		for(int n=0;n<N;n++){
			arr[n] = sc.nextInt();
			if(min==-1){
				min = arr[n];
				max = arr[n];
			}
			if(min > arr[n]) min = arr[n];
			if(max < arr[n]) max = arr[n];
		}

		System.out.println(max-min);

	}
}