y,a[1<<17],m;c(int*a,int*b){y=*a-*b;}x(int*a,int n,int i){int l=0,u=n;for(;u-l>1;a[m=l+u>>1]&i?u=m:(l=m));y=i?(*a^a[n-1])&i?i|((l=x(a,u,i/2))<(m=x(a+u,n-u,i/2))?l:m):x(a,n,i/2):0;}main(n){for(n=-2;~scanf("%d",++n+a););qsort(a,n,4,c);m=!printf("%d",x(a,n,1<<29));}