#include #include #include using namespace std; int main() { int n; cin >> n; vector a(n, 0); for (int i = 0; i < n; i++) { cin >> a[i]; } int xx = 0; int max0, max1; for (int i = 20; i >= 0; i--) { int x0 = xx; int x1 = xx + (1 << i); max0 = 0; max1 = 0; for (int j = 0; j < n; j++) { max0 = max(max0, a[j] ^ x0); max1 = max(max1, a[j] ^ x1); } xx = max0 < max1 ? x0 : x1; } int ans = max0 < max1 ? max0 : max1; cout << ans << endl; return 0; }