import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	} main {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		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 List<Integer> list=new ArrayList<Integer>(); list new ArrayList<Integer>() int max=0; max 0 for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		} int i=0; int i=0; i 0 n>i n i i++ i++ i {
			int a = sc.nextInt();
			list.add(a);
		} {
			int a = sc.nextInt();
			list.add(a);
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc list.add(a) list.add list a for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		} int i=0; int i=0; i 0 n-1>i n-1 n 1 i i++ i++ i {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		} {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		} for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			} int j=i+1; int j=i+1; j i+1 i 1 n>j n j j++ j++ j {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			} {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			} int b = Math.abs(list.get(i)-list.get(j)); b Math.abs(list.get(i)-list.get(j)) Math.abs Math list.get(i)-list.get(j) list.get(i) list.get list i list.get(j) list.get list j if(b>max)
					max=b; b>max b max max=b max b System.out.println(max) System.out.println System.out System System.out max String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		int n = sc.nextInt();
		List<Integer> list=new ArrayList<Integer>();
		int max=0;
		for(int i=0;n>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		for(int i=0;n-1>i;i++) {
			for(int j=i+1;n>j;j++) {
				int b = Math.abs(list.get(i)-list.get(j));
				if(b>max)
					max=b;
			}
		}
		System.out.println(max);
	}
}