#include using namespace std; #define endl '\n' #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define test cout<<"test"<= (ll)(n); i--) using ll = long long; using ld = long double; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>&v,ll h,ll w){for(ll i=0;i&v,ll h,ll w){for(ll i=0;i void debug(vector&v,ll n){if(n!=0)cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} vectordx={1,0,-1,0,1,1,-1,-1}; vectordy={0,1,0,-1,1,-1,1,-1}; template vector make_v(size_t a,T b){return vector(a,b);} template auto make_v(size_t a,Ts... ts){ return vector(a,make_v(ts...)); } ostream &operator<<(ostream &os, pair&p){ return os << p.first << " " << p.second; } const ll MAX_W=30; struct BitMatrix { ll h,w; vector>A; BitMatrix() {}; BitMatrix(ll n, ll m) :h(n),w(m){ A.assign(h,bitset(0)); }; BitMatrix(vector>v):h(v.size()),w(v[0].size()){ A.assign(h,bitset(0)); for(ll i=0;i &operator[](ll k) { return A[k]; } friend ostream &operator<<(ostream &os, BitMatrix &p) { ll n = p.height(), m = p.width(); for(ll i = 0; i < n; i++) { os << "["; for(ll j = 0; j < m; j++) { os << p[i][j] << (j + 1 == m ? "]\n" : ","); } } return (os); } }; vectorst; ll GaussJordan(BitMatrix a, bool is_extended){ ll h = a.height(), w = a.width(); ll rank = 0; ll limit = w - is_extended; vectorpre(20); rep(i,0,20)pre[i]=i; for(ll col=0;col>n; vectora(n); rep(i,0,n)cin>>a[i]; ll minbit=INF; ll lim=(1<<17); vectornum(lim); vectort(lim); rep(i,0,n){ bitset<20>x=a[i]; res+=a[i]; num[a[i]]++; for(ll j=a[i];jb; rep(i,1,lim){ if(t[i]){ //cout<x=i; rep(j,0,20)if(x[j])mat[j][cnt]=1; b.PB(i); cnt++; } } //cout<t2(lim,false); //cout<x=i; ll ret=0; rep(j,0,rank)if(x[j])ret^=b[st[j]]; t2[ret]=true; } ll maxbuf=0; rep(i,1,100001){ if(!t2[i])continue; //if(i<=20)cout<