Code:
#include <cstdio> #include <algorithm> #define ll long long #define N 64 #define setIO(s) freopen(s".in","r",stdin) using namespace std; ll d[N]; void insert(ll x) { for(int i=51;i>=0;--i) { if(x&((ll)1<<i)) { if(d[i]) x^=d[i]; else { d[i]=x; break; } } } } ll qmax() { ll x=0; for(int i=51;i>=0;--i) { if(d[i]) { if((x^d[i])>x) x^=d[i]; } } return x; } int main() { // setIO("input"); int n,i,j; scanf("%d",&n); for(i=1;i<=n;++i) { ll a; scanf("%lld",&a),insert(a); } printf("%lld ",qmax()); return 0; }