from functools import lru_cache n = int(input()) a = list(map(int, input().split())) @lru_cache(maxsize=None) def dfs(mask): if mask == (1 << n) - 1: return 0 # Find the first unpaired player for i in range(n): if not (mask & (1 << i)): first = i break max_total = 0 # Pair the first with all possible others for j in range(first + 1, n): if not (mask & (1 << j)): new_mask = mask | (1 << first) | (1 << j) current_xor = a[first] ^ a[j] total = current_xor + dfs(new_mask) if total > max_total: max_total = total return max_total print(dfs(0))