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(); } int[] dp = new int[1 << n]; HashSet pair = new HashSet<>(); 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; } dp[i] = base; pair.add(i); } else if (count % 2 == 0) { int max = 0; for (int x : pair) { if ((x & i) != x) { continue; } max = Math.max(max, dp[x] + dp[i ^ x]); } dp[i] = max; } } System.out.println(dp[(1 << n) - 1]); } static int getPopcount(int x) { int count = 0; while (x > 0) { count += x % 2; x /= 2; } return count; } }