#include<cstdio>
class LB {
private:
long long num[63];
public:
LB() {
for(int i = 0; i < 63; ++i) {
num[i] = 0;
}
}
void insert(long long key) {
for(int i = 62; i >= 0; --i) {
if(((key >> i) & 1) ^ 1) continue;
if(num[i] == 0) {
num[i] = key;
break;
} else {
key ^= num[i];
}
}
}
long long maxxor() {
long long res = 0;
for(int i = 62; i >= 0; --i) {
if((res >> i) & 1) continue;
res ^= num[i];
}
return res;
}
};
LB lb;
int main() {
int num;
scanf("%d", &num);
for(int i = 1; i <= num; ++i) {
long long key;
scanf("%lld", &key);
lb.insert(key);
}
printf("%lld\n", lb.maxxor());
return 0;
}
线性基
Share