#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i, n) for(int i = 0;i < n;i++) #define REPR(i, n) for(int i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(int i = 1;i <= n;i++) #define ll long long #define INF 1999999999 #define MINF -1999999999 #define INF64 1999999999999999999 #define ALL(n) n.begin(),n.end() #define MOD 1000000007 ll n, s[20], dp[100000]; int main() { cin >> n; REP(i, n) cin >> s[i]; REP(i, 1 << n) { REP(j, n) { if (!(i & 1 << j)) { REP(k, n) { if (j != k and !(i & 1 << k)) { dp[i + (1 << j) + (1 << k)] = max(dp[i + (1 << j) + (1 << k)], dp[i] + (s[j] xor s[k])); } } } } } cout << dp[(1 << n) - 1] << endl; }