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

public class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	}
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	}
} Main static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); pw new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))) public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	} main {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	} int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] yarra = new int[N]; yarra new int[N] N String[] split = br.readLine().split(" "); split br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " long max = -1; max -1 1 long min = 1000000001; min 1000000001 for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		} int i = 0; int i = 0; i 0 i < yarra.length i yarra.length yarra yarra.length i++ i++ i {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		} {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		} long x = Long.parseLong(split[i]); x Long.parseLong(split[i]) Long.parseLong Long split[i] split i max = Math.max(max, x) max Math.max(max, x) Math.max Math max x min = Math.min(min, x) min Math.min(min, x) Math.min Math min x pw.println(max - min) pw.println pw max - min max min pw.close() pw.close pw String[] args args public class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	}
} public class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	}
} Main
import java.util.*;
import java.io.*;

public class Main {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	
	public static void main(String[] args) throws Exception {
		int N = Integer.parseInt(br.readLine());
		
		int[] yarra = new int[N];
		String[] split = br.readLine().split(" ");
		long max = -1;
		long min = 1000000001;
		for(int i = 0; i < yarra.length; i++) {
			long x = Long.parseLong(split[i]);
			max = Math.max(max, x);
			min = Math.min(min, x);
		}
		pw.println(max - min);
		
		pw.close();
	}
}