#include #include using namespace std; using namespace atcoder; #define ll long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define repl(i,a,b) for(ll i=(a);i<(b);i++) #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(),(a).rend() template bool chmin(T &a,T b){if(a>b){a=b;return true;} return false;} template bool chmax(T &a,T b){if(a> n; vector a(n); rep(i,0,n) cin >> a[i]; set> st;; rep(i,0,n) st.insert({0,i}); for(int i=29;i>=0;i--){ if(i%2){ set> nst; for(auto [x,id]:st){ if(a[id]>>i&1){ nst.insert({x-(1<first; bool ch=false; for(auto [x,id]:st){ if(a[id]>>i&1 && mx == -x) ch=true; } set> nst; if(ch){ for(auto [x,id]:st){ if(a[id]>>i&1) nst.insert({x,id}); } swap(st,nst); } } } int ans=0; rep(i,0,30){ if(i%2 == 0){ bool ch=true; for(auto [x,id]:st){ if(!(a[id]>>i&1)) ch=false; } if(ch) ans+=1<>i&1) ch=true; } if(ch) ans+=1<> T; while(T--) solve(); }