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])); } static int check1(int idx, boolean[] used) { if (idx == n) { return 0; } int ans = 0; 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 int check2(int idx, boolean[] used, int v) { int max = 0; for (int i = 0; i < n; i++) { if (used[i]) { continue; } used[i] = true; max = Math.max(max, (v ^ values[i]) + check1(idx + 1, used)); used[i] = false; } return max; } } 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(); } }