import java.io.*; import java.util.*; public class Main { static int n; static int[] values; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); n = sc.nextInt(); values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); } System.out.println(check1(0, new boolean[n]).last()); } static TreeSet check1(int idx, boolean[] used) { if (idx == n) { TreeSet ans = new TreeSet<>(); ans.add(0); return ans; } TreeSet ans = null; for (int i = 0; i < n; i++) { if (!used[i]) { used[i] = true; ans = check2(idx + 1, used, values[i]); used[i] = false; break; } } return ans; } static TreeSet check2(int idx, boolean[] used, int v) { TreeSet ans = new TreeSet<>(); for (int i = 0; i < n; i++) { if (used[i]) { continue; } used[i] = true; TreeSet tmp = check1(idx + 1, used); for (int x : tmp) { ans.add((v + values[i]) ^ x); } used[i] = false; } return ans; } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }