import java.util.Scanner;

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

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[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[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		}
		System.out.println(max-min);

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

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		}
		System.out.println(max-min);

//------------------------------------------------------------
	} main {
//------------------------------------------------------------

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[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[] array = new int[N]; array new int[N] N for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		} int i=0 ; int i=0 ; i 0 i < N i N i++ i++ i {
			array[i] = sc.nextInt();
		} {
			array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc int max = array[0]; max array[0] array 0 int min = array[0]; min array[0] array 0 for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		} int i = 0 ; int i = 0 ; i 0 i<N i N i++ i++ i {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		} {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		} if (array[i]>max) {
				max=array[i];
			} array[i]>max array[i] array i max {
				max=array[i];
			} max=array[i] max array[i] array i if(array[i]<min) {
				min = array[i];
			} array[i]<min array[i] array i min {
				min = array[i];
			} min = array[i] min array[i] array 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[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[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[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[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[] array = new int[N];
		for (int i=0 ; i < N ; i++) {
			array[i] = sc.nextInt();
		}
		int max = array[0];
		int min = array[0];
		for (int i = 0 ; i<N ; i++) {
			if (array[i]>max) {
				max=array[i];
			}
			if(array[i]<min) {
				min = array[i];
			}
		}
		System.out.println(max-min);

//------------------------------------------------------------
	}
}