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 res = 0,p = 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(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; insert(a[i]); } int res = 0; for(int i = 0; i < n;i++) res = max(res,query(a[i])); cout << res << endl; return0; }