#include<iostream>usingnamespacestd;
constint maxn = 1e5+10;
int tot, tire[maxn*32][2];
void insert(int x){
int u = 0;
for(int i = 31; i >= 0; i--){
int c = (x>>i)&1;
if(!tire[u][c])tire[u][c] = ++tot;
u = tire[u][c];
}
}
int query(int x){
int u = 0, ans = 0;
for(int i = 31; i >= 0; i--){
int c = (x>>i)&1;
if(tire[u][!c])u = tire[u][!c], ans = (ans<<1)|1;
else u = tire[u][c], ans = ans<<1;
}
return ans;
}
int a[maxn];
int main(){
ios::sync_with_stdio(false);
int n; cin>>n;
for(int i = 1; i <= n; i++){
cin>>a[i]; insert(a[i]);
}
int ans = 0;
for(int i = 1; i <= n; i++)
ans = max(ans, query(a[i]));
cout<<ans<<'
';
return0;
}