import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } HashMap> dp = new HashMap<>(); HashMap pair = new HashMap<>(); for (int i = 1; i < (1 << n); i++) { int count = getPopcount(i); if (count == 2) { int base = 0; int value = i; for (int j = 0; j < n; j++) { if (value % 2 == 1) { base += arr[j]; } value /= 2; } pair.put(i, base); } else if (count % 2 == 0) { HashSet tmp = new HashSet<>(); for (int x : pair.keySet()) { if ((x & i) != x) { continue; } if (getPopcount(i ^ x) == 2) { tmp.add(pair.get(x) ^ pair.get(i ^ x)); } else { for (int y : dp.get(i ^ x)) { tmp.add(pair.get(x) ^ y); } } } dp.put(i, tmp); } } int max = 0; for (int x : dp.get((1 << n) - 1)) { max = Math.max(max, x); } System.out.println(max); } static int getPopcount(int x) { int count = 0; while (x > 0) { count += x % 2; x /= 2; } return count; } }