#include using namespace std; int n; int a[100000]; int main() { cin >> n; for (int i = 0; i < n; i++){ cin >> a[i]; } int cur = 0; for (int i = 30; i >= 0; i--){ int nxt = cur | (1 << i); int mx = 0, my = 0; for (int j = 0; j < n; j++){ mx = max(mx, a[j] ^ cur); my = max(my, a[j] ^ nxt); } if (mx > my) cur = nxt; } int res = 0; for (int i = 0; i < n; i++){ res = max(res, cur ^ a[i]); } cout << res << endl; }