#include using namespace std; int memo[30]; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; int ng = -1, ok = (1 << 30) - 1; while (ok - ng > 1) { int mid = (ok + ng) / 2; fill_n(memo, 30, -1); bool flag = true; for (int i = 0; i < n; i++) { int tmp = a[i]; for (int j = 29; j >= 0; j--) { if (memo[j] != -1) { tmp ^= (memo[j] << j); } else { bool flag1 = (tmp > mid); bool flag2 = ((tmp ^ (1 << j)) > mid); if (flag1) { if (!flag2) { memo[j] = 1; tmp ^= (1 << j); } } else if (flag2) { memo[j] = 0; } } } flag &= (tmp <= mid); if (!flag) break; } if (flag) ok = mid; else ng = mid; } cout << ok << endl; return 0; }