#include #include #include #include using namespace std; typedef long long llong; const llong MOD=1000000007LL; class XORER { public: llong xorerValues[64]; llong xorerSeq[64]; int sz=0; llong totalXor=0; llong waysToGet=1; llong pow2=0; XORER() { memset(xorerValues,0,sizeof(xorerValues)); } void addUseless() { waysToGet*=2LL; if (waysToGet>=MOD) waysToGet-=MOD; pow2++; return; } llong getSeq(llong num) { int i; llong seq=0; for (i=60;i>=0;i--) { if ( ((1LL<0 ) { seq^=xorerSeq[i]; num^=xorerValues[i]; } } return seq; } void addNum(llong num,llong seq) { int i; sz++; totalXor^=num; for (i=60;i>=0;i--) { if ( ( (1LL<0 ) { if (xorerValues[i]==0) { xorerValues[i]=num; xorerSeq[i]=seq; return; } else { num^=xorerValues[i]; seq^=xorerSeq[i]; } } } waysToGet*=2LL; if (waysToGet>=MOD) waysToGet-=MOD; pow2++; return; } bool checkNum(llong num) { int i; for (i=60;i>=0;i--) { if ( ((1LL<0 ) { num^=xorerValues[i]; } } return (num==0LL); } llong getWays(llong num) { if (checkNum(num)) return waysToGet; else return 0LL; } }; int n; XORER all; XORER evens; llong evensVal=-1; llong evensValSeq; vector goodNums; llong mergeFlipper; llong ans[101]; int aL=0; void printSeq(llong seq,llong num) { int i; llong x=0; aL=0; for (i=0;i<=61;i++) { if ( ((1LL<0 ) { aL++; ans[aL]=goodNums[i]; } } printf("%d",aL); for (i=1;i<=aL;i++) { printf(" %d",ans[i]); x^=ans[i]; } printf("\n"); if (x!=num) { fprintf(stderr,"WRONG OUTPUT\n"); while(1); } return; } int main() { freopen("xorset.in","r",stdin); freopen("xorset.out","w",stdout); int i,j; llong num; int cm; llong totalWays=0; bool merged=false; llong ans; int asctr=0; int example; bool noSol; scanf("%d",&n); for (i=1;i<=n;i++) { scanf("%d %lld",&cm,&num); if (cm==1) { if (all.checkNum(num)) { if (evens.checkNum(num) && !merged) ///Merging! { //cout<<"Merge at "<1) { fprintf(stderr,"TOO MANY MERGES\n"); while(1); } //fprintf(stderr,"Total merges = %d\n",asctr); return 0; }