

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	} main {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	} 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] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int result = 0; result 0 for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		} {
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		} for(int j = i + 1; j < n; j++){
				result = Math.max(result, 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 {
				result = Math.max(result, Math.abs(a[i] - a[j]));
			} {
				result = Math.max(result, Math.abs(a[i] - a[j]));
			} result = Math.max(result, Math.abs(a[i] - a[j])) result Math.max(result, Math.abs(a[i] - a[j])) Math.max Math result Math.abs(a[i] - a[j]) Math.abs Math a[i] - a[j] a[i] a i a[j] a j System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		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();
		}

		int result = 0;

		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				result = Math.max(result, Math.abs(a[i] - a[j]));
			}
		}

		System.out.println(result);
	}

}
