#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int a[N], tt[N * 32][5], idx;
void insert(int x) {
int p = 1;
for(int i = 30; i >= 0; i--) {
int u = x >> i & 1ll;
if(!tt[p][u])tt[p][u] = idx++;
p = tt[p][u];
}
}
int search(int x) {
int p = 1, ans = 0;
for(int i = 30; i >= 0; i--) {
int u = x >> i &1ll;
if(tt[p][u^1ll]) {
p = tt[p][u^1ll];
ans +=(1ll << i);
} else p = tt[p][u];
}
return ans;
}
int main() {
freopen("xorpair.in","r",stdin);
freopen("xorpair.out","w",stdout);
int n;
cin >> n;
idx =2;
for(int i = 0; i < n; i++) {
cin >> a[i];
insert(a[i]);
}
int res = 0;
for(int i = 0; i < n; i++){
res = max(res, search(a[i]));
}
cout << res << ' ';
return 0;
}