#include using namespace std; void wa_haya_exe(); void solve(); int main() { wa_haya_exe(); solve(); } // -------------------------------------------------------------------------------------------------------------- #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") void wa_haya_exe() { cin.tie(nullptr); ios::sync_with_stdio(false); } mt19937 Random() { random_device seed_gen; mt19937 engine {seed_gen()}; return engine; } // -------------------------------------------------------------------------------------------------------------- // alias template using V = vector; template using P = pair; template using pq = priority_queue; template using pqr = priority_queue,greater>; using ll = long long; using ld = long double; using ul = unsigned long long; using pi = P; using pd = P; using pc = P; using ps = P; // Input template void scan(T& a) { cin >> a; } template void scan(pair& p) { scan(p.first); scan(p.second); } template void scan(V& a) { for(auto &i: a) scan(i); } void in(){} template void in(Head& head, Tail&... tail) { scan(head); in(tail...); } #define INT(...) int __VA_ARGS__;in(__VA_ARGS__) #define LL(...) ll __VA_ARGS__;in(__VA_ARGS__) #define UL(...) ul __VA_ARGS__;in(__VA_ARGS__) #define CHR(...) char __VA_ARGS__;in(__VA_ARGS__) #define STR(...) string __VA_ARGS__;in(__VA_ARGS__) #define DBL(...) double __VA_ARGS__;in(__VA_ARGS__) #define LD(...) ld __VA_ARGS__;in(__VA_ARGS__) // Output #define println(x) cout << x << endl; #define printb(x) cout << x << " "; #define print(x) cout << x; #define fix(x) cout << fixed << setprecision(x); #define NL cout << endl; #define None println(-1) // YesNo System #define Yes println("Yes") #define No println("No") #define YesNo(bool) if(bool) Yes else No #define YESNO(bool) if(bool) println("YES") else println("NO") #define yesno(bool) if(bool) println("yes") else println("no") // constance constexpr int mod=1000000007; //constexpr int mod=998244353; const int INF=0x3fffffff; const ll LINF=0x1fffffffffffffff; const ld DINF=numeric_limits::infinity(); const double PI=acos(-1); // for #define overload4(_1,_2,_3,_4,name,...) name #define overload3(_1,_2,_3,name,...) name #define rep1(n) for(ll i=0; i=0; i--) #define rvp2(i,n) for(ll i=n-1; i>=0; i--) #define rvp3(i,a,b) for(ll i=b-1; i>=a; i--) #define rvp4(i,a,b,c) for(ll i=b-1; i>=a; i-=c) #define rvp(...) overload4(__VA_ARGS__,rvp4,rvp3,rvp2,rvp1)(__VA_ARGS__) #define all1(v) v.begin(),v.end() #define all2(v,a) v.begin(),v.begin()+a #define all3(v,a,b) v.begin()+a,v.begin()+b #define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__) #define each1(elem,v) for(auto &elem: v) #define each2(x,y,v) for(auto &[x,y]: v) #define each3(x,y,z,v) for(auto &[x,y,z]: v) #define each(...) overload4(__VA_ARGS__,each3,each2,each1)(__VA_ARGS__) #define sqrp1(n) for(ll i=0; i*i name(__VA_ARGS__) #define Vec(type,name) vector name #define VEC(type,name,size) vectorname(size);in(name) #define wec(type,name,h,...) vector> name(h,vector(__VA_ARGS__)) #define Wec(type,name,h) vector>name(h) #define WEC(type,name,h,w) vector> name(h,vector(w));in(name) #define rall(v) v.rbegin(), v.rend() #define rev(v) reverse(all(v)) #define Sort(v) sort(all(v)) #define Sortt(v) sort(rall(v)) #define Min(v) *min_element(all(v)) #define Max(v) *max_element(all(v)) #define LB(v,x) lower_bound(all(v),x) #define UB(v,x) upper_bound(all(v),x) #define vsum(v) accumulate(all(v),0LL) #define vdsum(v) accumulate(all(v),0.0L) #define vmul(v) accumulate(all(v),1,[](int acc,int i) { return acc*i; }) #define ers(v,x) v.erase(remove(all(v),x),v.end()) #define unq(v) Sort(v);v.erase(unique(all(v)),v.end()) #define cp(v,w) copy(all(v),back_inserter(w)) #define smp(v,w,size,eng) sample(all(v),back_inserter(w),size,eng); #define rpl(v,f,r) replace_if(all(v),f,r) #define rtt(v,idx) rotate(all(v,idx),v.end()) #define All(v,f) all_of(all(v),f) #define Exist(v,f) any_of(all(v),f) #define Find(v,x) find(all(v),x) #define cntif(v,f) count_if(all(v),f) template inline T Count(V& v, ll x) { Sort(v); return UB(v,x)-LB(v,x); } template inline void out1(V& v) { FE(v,[](T x){printb(x)}); NL } template inline void out2(V& v) { FE(v,[](T x){println(x)}); } // renew max(old < new) or min(old > new) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; } template bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; } // overflow template bool overflow_if_add(T a, T b) { return (numeric_limits::max() - a) < b; } template bool overflow_if_mul(T a, T b) { return (numeric_limits::max() / a) < b; } // tips #define elif else if #define scp(a,x,b) a<=x&&x<=b #define mp make_pair #define mt make_tuple #define bit_check(bit,tar) (tar>>bit)&1 #define bit1cnt(x) __builtin_popcountll(x) #define str_rpl(s,a,b) regex_replace(s,regex(a),b) template constexpr auto mymin(T... a) { return min(initializer_list>{a...}); } template constexpr auto mymax(T... a) { return max(initializer_list>{a...}); } // Permutation template inline void nPr(V& v) { Sort(v); do { each(num,v) printb(num); NL } while(next_permutation(all(v))); } // fuctorial template inline T fct(T& n) { T f=1; rep(i,1,n+1) { f*=i; } return f; } // UnionFind-Tree struct UnionFind { V par,sz; UnionFind(ll n) { par.resize(n,0); sz.resize(n,0); rep(n) makeTree(i); } void makeTree(ll x) { par[x]=x; sz[x]=1; } bool same(ll x, ll y) { return root(x)==root(y); } bool unite(ll x, ll y) { x=root(x); y=root(y); if(x==y) return 0; if(sz[x]>sz[y]) { par[y]=x; sz[x]+=sz[y]; } else { par[x]=y; sz[y]+=sz[x]; } return 1; } ll root(ll x) { if(x!=par[x]) par[x]=root(par[x]); return par[x]; } ll size(ll x) { return sz[root(x)]; } }; // MODINT struct Modint{ unsigned num = 0; constexpr Modint() noexcept {} constexpr Modint(const Modint &x) noexcept : num(x.num){} constexpr operator ll() const noexcept { return num; } constexpr Modint& operator+=(Modint x) noexcept { num += x.num; if(num >= mod) num -= mod; return *this; } constexpr Modint& operator++() noexcept { if(num == mod - 1) num = 0; else num++; return *this; } constexpr Modint operator++(int) noexcept { Modint ans(*this); operator++(); return ans; } constexpr Modint operator-() const noexcept { return Modint(0) -= *this; } constexpr Modint& operator-=(Modint x) noexcept { if(num < x.num) num += mod; num -= x.num; return *this; } constexpr Modint& operator--() noexcept { if(num == 0) num = mod - 1; else num--; return *this; } constexpr Modint operator--(int) noexcept { Modint ans(*this); operator--(); return ans; } constexpr Modint& operator*=(Modint x) noexcept { num = ul(num) * x.num % mod; return *this; } constexpr Modint& operator/=(Modint x) noexcept { return operator*=(x.inv()); } template constexpr Modint(T x) noexcept { using U = typename conditional= 4, T, int>::type; U y = x; y %= U(mod); if(y < 0) y += mod; num = uint(y); } template constexpr Modint operator+(T x) const noexcept { return Modint(*this) += x; } template constexpr Modint& operator+=(T x) noexcept { return operator+=(Modint(x)); } template constexpr Modint operator-(T x) const noexcept { return Modint(*this) -= x; } template constexpr Modint& operator-=(T x) noexcept { return operator-=(Modint(x)); } template constexpr Modint operator*(T x) const noexcept { return Modint(*this) *= x; } template constexpr Modint& operator*=(T x) noexcept { return operator*=(Modint(x)); } template constexpr Modint operator/(T x) const noexcept { return Modint(*this) /= x; } template constexpr Modint& operator/=(T x) noexcept { return operator/=(Modint(x)); } constexpr Modint inv() const noexcept { ll x = 0, y = 0; extgcd(num, mod, x, y); return x; } static constexpr ll extgcd(ll a, ll b, ll &x, ll &y) noexcept { ll g = a; x = 1; y = 0; if(b){ g = extgcd(b, a % b, y, x); y -= a / b * x; } return g; } constexpr Modint pow(ul x) const noexcept { Modint ans = 1, cnt = *this; while(x){ if(x & 1) ans *= cnt; cnt *= cnt; x /= 2; } return ans; } }; ostream& operator<<(ostream& os, const Modint& m){ os << m.num; return os; } // -------------------------------------------------------------------------------------------------------------- void solve() { INT(q); set s; map cnt; while(q--) { INT(n); if(n==1) { INT(x); if(s.count(x)) continue; s.insert(x); rep(30) if(bit_check(i,x)) cnt[i]++; } elif(n==2) { LL(x); if(!s.count(x)) continue; s.erase(x); rep(30) if(bit_check(i,x)) cnt[i]--; } else { if(s.empty()) None else { ll ans=0; rep(30) if(cnt[i]==s.size()) ans+=(int)pow(2,i); println(ans) } } } }