```#include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N = 1000010, M = 31 * N;
int son[M][2];
int cnt[N];
int n,idx;
void insert(int x)
{
int p = 0; //根节点
for (int i = 30; i >= 0; i–) //str[i]用来判断是否走到结尾了
{
// 前面的<< : 将x的二进制位向右移动i位(想象一下整个二进制数组往右平移,前面的补0)
// 后面的& : 判断二进制数是 0 || 1
int u = x >> i & 1; //现在的u不是0就是1,取决于它是奇数还是偶数
if (!son[p][u]) son[p][u] = ++idx;//如没有,则创建
p = son[p][u];
}
}
int query(int x)
{
int p = 0,res = 0;
for (int i = 30;i >= 0; i–)
{
int u = x >> i & 1;
if (son[p][!u])
{
//res * 2 : 相当于把res往左移一位,这样第一位就是0,然后加上后面的!u,如果u = 1,则+1,;u = 0,则+0
//trie树往后走一步
p = son[p][!u];
res = res * 2 + !u;
}
else
{
p = son[p][u];
res = res * 2 + u;
}
}
return res;
}
int main()
{
scanf(“%d”, &n);
int res = 0;
for (int i = 0; i < n; i++) scanf(“%d”, &cnt[i]);
for (int i = 0; i < n; i++)
{
insert(cnt[i]);
int t = query(cnt[i]);
res = max(res, cnt[i] ^ t);
}
printf("%d\n", res);
return 0;
}
blablabla
```