#include<iostream>intgcd(int a,int b){return b ?gcd(b, a % b): a;}usingnamespace std;typedeflonglong ll;typedef pair<int,int> PII;constint N =100010, M =3000000;int son[M][2], idx, a[N];voidinsert(int x){int p =0;for(int i =30;~i;--i){int&s = son[p][x >> i &1];if(!s)s =++idx;
p = s;}}intquery(int x){int p =0;int res =0;for(int i =30;~i;--i){int s = x >> i &1;if(son[p][!s]){
res +=1<<i;
p = son[p][!s];}else p = son[p][s];}return res;}intmain(){int n;cin >> n;for(int i =0;i<n;++i){scanf("%d",&a[i]);insert(a[i]);}int ans =0;for(int i =0;i<n;++i){
ans =max(ans,query(a[i]));}printf("%d\n",ans);return0;}