import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	}
} Main public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	} run {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.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] a i sc.nextInt() sc.nextInt sc sc.close() sc.close sc int res = 0; res 0 int dif; dif for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		} 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++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		} {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		} for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			} int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			} {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			} dif = Math.abs(a[i]-a[j]) dif Math.abs(a[i]-a[j]) Math.abs Math a[i]-a[j] a[i] a i a[j] a j if(dif > res) res = dif; dif > res dif res res = dif res dif System.out.println(res) System.out.println System.out System System.out res public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	}
} public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().run();
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i=0; i<n; i++) a[i] = sc.nextInt();
		sc.close();
		
		int res = 0;
		int dif;
		for(int i=0; i<n-1; i++) {
			for(int j=i+1; j<n; j++) {
				dif = Math.abs(a[i]-a[j]);
				if(dif > res) res = dif;
			}
		}
		System.out.println(res);
	}
}