import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	} _main {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	} Scanner sc = new Scanner(in); sc new Scanner(in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] a = new int[N]; a new int[N] N for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int ans = Integer.MIN_VALUE; ans Integer.MIN_VALUE Integer Integer.MIN_VALUE for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		} int i=0; int i=0; i 0 i<N-1 i N-1 N 1 i++ i++ i {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		} {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		} for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			} int j=i+1; int j=i+1; j i+1 i 1 j<N j N j++ j++ j {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			} {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			} ans = Math.max(ans, Math.abs(a[i]-a[j])) ans Math.max(ans, Math.abs(a[i]-a[j])) Math.max Math ans Math.abs(a[i]-a[j]) Math.abs Math a[i]-a[j] a[i] a i a[j] a j out.println(ans) out.println out ans sc.close() sc.close sc String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int N = sc.nextInt();
		int[] a = new int[N];
		
		for(int i=0;i<N;i++) {
			a[i] = sc.nextInt();
		}
		
		int ans = Integer.MIN_VALUE;
		
		for(int i=0;i<N-1;i++) {
			for(int j=i+1;j<N;j++) {
				ans = Math.max(ans, Math.abs(a[i]-a[j]));
			}
		}
		out.println(ans);
		
		sc.close();

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}
