#include #define rep(i,a,b) for(ll i=ll(a);i> N; vector A(N); ll maxi = 0; rep(i,0,N){ cin >> A[i]; maxi = max(maxi, A[i]); } for(ll i = 32;i >= 0;i--){ ll bit = (ll)1 << i; //if(!(bit & maxi))continue; ll submax = 0; rep(j,0,N){ submax = max(submax, A[j] ^ bit); //cout << (A[j] ^ bit) << " "; } //cout << endl; //cout << submax << " " << maxi << endl; if(submax >= maxi)continue; maxi = submax; rep(j,0,N){ A[j] ^= bit; } } cout << maxi << endl; }