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

class Main {
	public static void main(String... args) {
		int N = IN.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		}
		puts(ans);
		flush();
	}
	static final Scanner IN = new Scanner(System.in);
	static final PrintWriter OUT = new PrintWriter(System.out);
	static <T> void puts(T arg) { OUT.println(arg); }
	static void flush() { OUT.flush(); }
} import java.util.*; util.* java import java.io.*; io.* java class Main {
	public static void main(String... args) {
		int N = IN.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		}
		puts(ans);
		flush();
	}
	static final Scanner IN = new Scanner(System.in);
	static final PrintWriter OUT = new PrintWriter(System.out);
	static <T> void puts(T arg) { OUT.println(arg); }
	static void flush() { OUT.flush(); }
} Main static final Scanner IN = new Scanner(System.in); IN new Scanner(System.in) static final PrintWriter OUT = new PrintWriter(System.out); OUT new PrintWriter(System.out) public static void main(String... args) {
		int N = IN.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		}
		puts(ans);
		flush();
	} main {
		int N = IN.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		}
		puts(ans);
		flush();
	} int N = IN.nextInt(); N IN.nextInt() IN.nextInt IN int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = IN.nextInt();
		} {
			A[i] = IN.nextInt();
		} A[i] = IN.nextInt() A[i] A i IN.nextInt() IN.nextInt IN int ans = 0; ans 0 for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		} {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		} for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < N j N j++ j++ j {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			} {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			} int tmp = Math.abs(A[i] - A[j]); tmp Math.abs(A[i] - A[j]) Math.abs Math A[i] - A[j] A[i] A i A[j] A j if (tmp > ans) {
					ans = tmp;
				} tmp > ans tmp ans {
					ans = tmp;
				} ans = tmp ans tmp puts(ans) puts ans flush() flush String... args args static <T> void puts(T arg) { OUT.println(arg); } puts { OUT.println(arg); } OUT.println(arg) OUT.println OUT arg T arg arg static void flush() { OUT.flush(); } flush { OUT.flush(); } OUT.flush() OUT.flush OUT
import java.util.*;
import java.io.*;

class Main {
	public static void main(String... args) {
		int N = IN.nextInt();
		int[] A = new int[N];
		for (int i = 0; i < N; i++) {
			A[i] = IN.nextInt();
		}

		int ans = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
				int tmp = Math.abs(A[i] - A[j]);
				if (tmp > ans) {
					ans = tmp;
				}
			}
		}
		puts(ans);
		flush();
	}
	static final Scanner IN = new Scanner(System.in);
	static final PrintWriter OUT = new PrintWriter(System.out);
	static <T> void puts(T arg) { OUT.println(arg); }
	static void flush() { OUT.flush(); }
}
