import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
} Main public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} main {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	} MaximumDifference solver = new MaximumDifference(); solver new MaximumDifference() solver.readInput() solver.readInput solver solver.solve() solver.solve solver solver.writeOutput() solver.writeOutput solver String[] args args static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	} MaximumDifference private int n; n private ArrayList<Integer> a; a private int output; output private Scanner scanner; scanner public MaximumDifference() {
			scanner = new Scanner(System.in);
		} MaximumDifference {
			scanner = new Scanner(System.in);
		} scanner = new Scanner(System.in) scanner new Scanner(System.in) public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		} readInput {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		} a = new ArrayList<Integer>() a new ArrayList<Integer>() n = scanner.nextInt() n scanner.nextInt() scanner.nextInt scanner for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			} int i=0; int i=0; i 0 i<n i n i++ i++ i {
				a.add(scanner.nextInt());
			} {
				a.add(scanner.nextInt());
			} a.add(scanner.nextInt()) a.add a scanner.nextInt() scanner.nextInt scanner public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		} solve {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		} Collections.sort(a) Collections.sort Collections a output = a.get(a.size()-1) - a.get(0) output a.get(a.size()-1) - a.get(0) a.get(a.size()-1) a.get a a.size()-1 a.size() a.size a 1 a.get(0) a.get a 0 public void writeOutput() {
			System.out.println(output);
		} writeOutput {
			System.out.println(output);
		} System.out.println(output) System.out.println System.out System System.out output public class Main {

	public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
} public class Main {

	public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
} Main
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		MaximumDifference solver = new MaximumDifference();
		solver.readInput();
		solver.solve();
		solver.writeOutput();
	}

	static class MaximumDifference {

		private int n;
		private ArrayList<Integer> a;
		private int output;

		private Scanner scanner;

		public MaximumDifference() {
			scanner = new Scanner(System.in);
		}

		public void readInput() {
			a = new ArrayList<Integer>();
			n = scanner.nextInt();
			for(int i=0; i<n; i++) {
				a.add(scanner.nextInt());
			}
		}

		public void solve() {
			Collections.sort(a);
			output = a.get(a.size()-1) - a.get(0);
		}

		public void writeOutput() {
			System.out.println(output);
		}
	}
}
