import java.io.BufferedInputStream; import java.io.IOException; import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; import java.util.Map.Entry; public class Main { public static final int C = 1000000007; static final int CY = 1000000000; //static boolean MAP[][]; static int N; static long M; static int MAX = -1; //static int tic[][]; static int A[]; //static int max; static int DP[][][]; static int ST[][]; //static int p[]; //static ArrayList> al; static TreeMap> hm; //static ArrayList al; //static int a[][]; //static char[][] ch; //static ArrayList> al; //static String a[]; //static String str; public static void main(String[] args) { StringBuilder sb = new StringBuilder(); BufferedInputStream bs = new BufferedInputStream(System.in); Scanner sc = new Scanner(bs); N = sc.nextInt(); A= new int[N]; for (int i=0; i < N; i++) { A[i] = sc.nextInt(); } //BigInteger bi = new BigInteger("0"); long ans = Integer.MAX_VALUE; for (int i=0; i < N; i++){ int max = 0; for (int t=0; t < N; t++) { max = Math.max(max, A[i] ^ A[t]); } ans = Math.min(ans, max); } System.out.println(ans); } }