import java.io.*;
import java.util.*;

public class Main {
	private static final int READ_COUNT = 2;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	private static final int READ_COUNT = 2;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
} Main private static final int READ_COUNT = 2; READ_COUNT 2 private static List<String> strList = new ArrayList<>(); strList new ArrayList<>() public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	} main {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	} read() read int n = Integer.parseInt(strList.get(0)); n Integer.parseInt(strList.get(0)) Integer.parseInt Integer strList.get(0) strList.get strList 0 String[] as = strList.get(1).split(" "); as strList.get(1).split(" ") strList.get(1).split strList.get(1) strList.get strList 1 " " int min = Integer.parseInt(as[0]); min Integer.parseInt(as[0]) Integer.parseInt Integer as[0] as 0 int max = min; max min for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		} {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		} int num = Integer.parseInt(as[i]); num Integer.parseInt(as[i]) Integer.parseInt Integer as[i] as i min = Math.min(min, num) min Math.min(min, num) Math.min Math min num max = Math.max(max, num) max Math.max(max, num) Math.max Math max num System.out.println(max - min) System.out.println System.out System System.out max - min max min String[] args args private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	} read {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		} catch (IOException e) {
		} IOException e {
		} {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			} int i = 0; int i = 0; i 0 i < READ_COUNT i READ_COUNT i++ i++ i {
				strList.add(br.readLine());
			} {
				strList.add(br.readLine());
			} strList.add(br.readLine()) strList.add strList br.readLine() br.readLine br public class Main {
	private static final int READ_COUNT = 2;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
} public class Main {
	private static final int READ_COUNT = 2;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	private static final int READ_COUNT = 2;
	private static List<String> strList = new ArrayList<>();
	
	public static void main(String[] args) {
		read();
		
		int n = Integer.parseInt(strList.get(0));
		String[] as = strList.get(1).split(" ");
		
		int min = Integer.parseInt(as[0]);
		int max = min;
		
		for (int i = 1; i < n; i++) {
			int num = Integer.parseInt(as[i]);
			min = Math.min(min, num);
			max = Math.max(max, num);
		}
		
		System.out.println(max - min);
	}
	
	private static void read() {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			for (int i = 0; i < READ_COUNT; i++) {
				strList.add(br.readLine());
			}
		} catch (IOException e) {
		}
	}
}
