#include using namespace std; #define rep(i,n) for (int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a v(30,0); set s; ll q; cin >> q; while(q--){ ll p; cin >> p; if(p==1){ ll x; cin >> x; if(s.count(x)) continue; s.insert(x); rep(i,30){ if(x&(1<> x; if(!s.count(x)) continue; s.erase(x); rep(i,30){ if(x&(1<