#include <bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e5+10;
int ch[maxn*32][2];//01字典树
int val[maxn*32];//节点值
int tot;
void init(){
tot=1;
memset(ch[0],0,sizeof(ch[0]));
}
void Insert(int x){
int u=0;
for(int i=31;i>=0;i--){
int v=(x>>i)&1;
if(!ch[u][v]){
ch[tot][0]=ch[tot][1]=0;
val[tot]=0;
ch[u][v]=tot++;
}
u=ch[u][v];
}
val[u]=x;
}
int Find(int x){
int u=0;
for(int i=31;i>=0;i--){
int v=(x>>i)&1;
if(ch[u][v^1])u=ch[u][v^1];
else u=ch[u][v];
}
return val[u];
}
int a[maxn];
signed main(){
init();
int n;
scanf("%lld",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
Insert(a[i]);
//puts("ok");
}
int ans=0;
for(int i=1;i<=n;i++){
int now=Find(a[i]);
//puts("ok");
ans=max(ans,now^a[i]);
}
printf("%lld\n",ans);
return 0;
}