#include using namespace std; using ll = long long; template using vt = vector; template using vvt = vector>; template using ttt = tuple; using tii = tuple; using vi = vector; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define pb push_back #define mt make_tuple #define ALL(a) (a).begin(),(a).end() #define FST first #define SEC second #define DEB cerr<<"!"<0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;} inline ll lcm(ll d1, ll d2){return d1 / __gcd(d1, d2) * d2;} /*Coding Space*/ template // T は双方向イテレータ inline constexpr bool next_patial_permitation(T first, T middle, T last){ // nP_middleを列挙 reverse(middle+1, last); return next_permutation(first, last); } int main(){ int n; cin >> n; vi in(n); rep(i,n) cin >> in[i]; sort(ALL(in)); int ans = 0; //int a = 0; do{ //++a; int tans = 0; for(int i = 0; i+1 < n; i+=2) tans += in[i] ^ in[i+1]; ans = max(ans, tans); }while(next_patial_permitation::iterator>(in.begin(), in.begin() + n/2, in.end())); cout << ans << endl; //cerr << a << endl; }