#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; ++i) #define rrep(i, st, n) for (int i = st; i < n; ++i) using pii = pair; const int inf = 1e9 + 7; int dy[] = {1, 1, 0, -1, -1, 0}; int dx[] = {1, 0, -1, -1, 0, 1}; #define ceil(a, b) a / b + !!(a % b) #define chmax(a, b) a = max(a, b) int main() { int n; cin >> n; int A[n]; rep(i, n) cin >> A[i]; int dp[1 << n]; rep(i, (1 << n)) dp[i] = 0; rep(i, (1 << n)) { rep(a, n) rrep(b, a + 1, n) if (!(i & (1 << a)) && !(i & (1 << b))) { chmax(dp[i + (1 << a) + (1 << b)] , dp[i] + (A[a] ^ A[b])); } } cout << dp[(1 << n) - 1] << endl; }