import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//input
		int n = sc.nextInt();
		int[] a = new int[n];
		int max = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		//method
		for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		}
		System.out.println(max);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//input
		int n = sc.nextInt();
		int[] a = new int[n];
		int max = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		//method
		for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		}
		System.out.println(max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//input
		int n = sc.nextInt();
		int[] a = new int[n];
		int max = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		//method
		for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);

		//input
		int n = sc.nextInt();
		int[] a = new int[n];
		int max = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		//method
		for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		}
		System.out.println(max);
	} 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 int max = 0; max 0 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 for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		} int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		} {
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		} for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			} int j=1; int j=1; j 1 j<a.length j a.length a a.length j++ j++ j {
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			} {
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			} int diff = Math.abs(a[i]-a[j]); diff Math.abs(a[i]-a[j]) Math.abs Math a[i]-a[j] a[i] a i a[j] a j if(diff>max){
					max = diff;
				} diff>max diff max {
					max = diff;
				} max = diff max diff System.out.println(max) System.out.println System.out System System.out max String[] args args
import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//input
		int n = sc.nextInt();
		int[] a = new int[n];
		int max = 0;
		for(int i=0; i<n; i++){
			a[i] = sc.nextInt();
		}

		//method
		for(int i=0; i<a.length; i++){
			for(int j=1; j<a.length; j++){
				int diff = Math.abs(a[i]-a[j]);
				if(diff>max){
					max = diff;
				}
			}
		}
		System.out.println(max);
	}
}