constint N = 100009; int n, numbers[N]; int trie[31 * N][2]; int idx;
voidbuild_trie(int &num) { int p = 0; for (int i = 30; ~i; --i) { int u = num >> i & 1; if (!trie[p][u]) trie[p][u] = ++idx; p = trie[p][u]; } }
ll query(int &num) { int p = 0; ll target = 0; for (int i = 30; ~i; --i) { int u = num >> i & 1; if (trie[p][!u]) { target = (target << 1) + !u; p = trie[p][!u]; } else { target = (target << 1) + u; p = trie[p][u]; } } return target; }
intmain() { cin.tie(nullptr)->sync_with_stdio(false); cin >> n; for (int i = 0; i < n; ++i) cin >> numbers[i]; ll res = 0; for (int i = 0; i < n; ++i) { int cur = numbers[i]; build_trie(cur); res = max(res, query(cur) ^ cur); } cout << res << endl; return0; }