#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' const int M = 1e5 + 5, mod = 1e9 + 7; int tr[M*33][2], tot; void insert(int x) { int now = 0; for (int i = 31; i >= 0; i--) { int j = x >> i & 1; if (!tr[now][j]) tr[now][j] = ++tot; now = tr[now][j]; } } int query(int x) { int now = 0, ans = 0; for (int i = 31; i >= 0; --i) { int j = x >> i & 1; if (j == 1) { if (tr[now][0]) { now = tr[now][0]; ans += (1 << i); } else { now = tr[now][1]; } } else { if (tr[now][1]) { now = tr[now][1]; ans += (1 << i); } else { now = tr[now][0]; } } } return ans; } void solve() { int n; cin >> n; int ans = 0; while (n--) { int x; cin >> x; insert(x); ans = max(ans, query(x)); } cout << ans << endl; } signed main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int t = 1; // cin >> t; while (t--) solve(); return 0; }

