#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int n;
int s[N];
class made{
public:
int son[3];
}a[N<<4]; //内存开大?
int tot,ans;
void insert(int x){
int p = 0;
for(int i = 31;i >= 0;i--){//反向建因为要尽可能使答案大
int u = (x >> i) & 1ll;
if(a[p].son[u] == 0)a[p].son[u] = ++tot;
p = a[p].son[u];
}//全建成Trie
}
void ask(int x){
int p = 0,su = 0;
for(int i = 31;i >= 0;i--){//反向建因为要尽可能使答案大
int u = (x >> i) & 1ll;
if(a[p].son[u^1])su += (1ll << i),p = a[p].son[u^1];//不同为1
else p = a[p].son[u];//相同为0
}//1找0,0找1 异或
ans = max(ans,su);
}
int main(){
freopen("xorpair.in","r",stdin);
freopen("xorpair.out","w",stdout);
scanf("%d",&n);
for(int i = 1;i <= n;i++){
int x;
scanf("%d",&s[i]);
insert(s[i]);
}
for(int i = 1;i <= n;i++)
ask(s[i]);
printf("%d\n",ans);
return 0;
}