#include #include using namespace std; int main() { unsigned int q, i, t; int j; long x; unsigned int c[31] = {0}; set s; cin >> q; for (i = 0; i < q; i++) { cin >> t; switch (t) { case 1: cin >> x; if (s.count(x) == 0) { s.insert(x); for (j = 0; j < 31; j++) if ((1 << j) & x) c[j]++; } break; case 2: cin >> x; if (s.count(x) != 0) { s.erase(x); for (j = 0; j < 31; j++) if ((1 << j) & x) c[j]--; } break; default: if (s.size() > 0) { x=0; for(j=30;j>=0;j--) { x=x<<1; if(c[j]==s.size()) x++; } } else x = -1; cout << x << endl; break; } } }