import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc sc.nextLine() sc.nextLine sc int[] num = new int[N]; num new int[N] N int max = 0; max 0 int min = 0; min 0 for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		} {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		} num[i] = sc.nextInt() num[i] num i sc.nextInt() sc.nextInt sc if ( max < num[i]) {
				max = num[i];
			} max < num[i] max num[i] num i {
				max = num[i];
			} max = num[i] max num[i] num i min = num[0] min num[0] num 0 for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if (min > num[i]) {
				min = num[i];
			}
		} {
			if (min > num[i]) {
				min = num[i];
			}
		} if (min > num[i]) {
				min = num[i];
			} min > num[i] min num[i] num i {
				min = num[i];
			} min = num[i] min num[i] num i int result = max - min; result max - min max min System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		sc.nextLine();
		int[] num = new int[N];
		int max = 0;
		int min = 0;
		for (int i = 0; i < N; i++) {
			num[i] = sc.nextInt();
			if ( max < num[i]) {
				max = num[i];
			}
		}
		min = num[0];
		for (int i = 0; i < N; i++) {
			if (min > num[i]) {
				min = num[i];
			}
		}
		int result = max - min;
		System.out.println(result);
	}
}
