import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	}

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

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	}

} Main public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	} main {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long[] a = new long[n]; a new long[n] n for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			a[i] = sc.nextLong();
		} {
			a[i] = sc.nextLong();
		} a[i] = sc.nextLong() a[i] a i sc.nextLong() sc.nextLong sc long m = 0; m 0 for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		} {
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		} for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			} int j=i+1; int j=i+1; j i+1 i 1 j<n j n j++ j++ j {
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			} {
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			} long ab = a[i]-a[j]; ab a[i]-a[j] a[i] a i a[j] a j if ( ab < 0 ) ab*=(-1); ab < 0 ab 0 ab*=(-1) ab (-1) 1 if ( ab>m ) m = ab; ab>m ab m m = ab m ab System.out.println(m) System.out.println System.out System System.out m String[] args args public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	}

} public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		
		long[] a = new long[n];

		for (int i=0; i<n;i++){
			a[i] = sc.nextLong();
		}
		
		long m = 0;
		for(int i=0; i<n;i++){
			for(int j=i+1;j<n;j++){
				long ab = a[i]-a[j];
				if ( ab < 0 ) ab*=(-1);
			
				if ( ab>m ) m = ab;
			}
		}
		
		System.out.println(m);
		
	}

}
