#include using namespace std; int main(){ int Q; cin >> Q; vector C(30, 0); int cnt = 0; set st; for (int i = 0; i < Q; i++){ int t; cin >> t; if (t == 1){ int x; cin >> x; if (st.count(x) == 0){ st.insert(x); for (int j = 0; j < 30; j++){ if ((x >> j & 1) == 1){ C[j]++; } } cnt++; } } if (t == 2){ int x; cin >> x; if (st.count(x) == 1){ st.erase(x); for (int j = 0; j < 30; j++){ if ((x >> j & 1) == 1){ C[j]--; } } cnt--; } } if (t == 3){ if (st.empty()){ cout << -1 << endl; } else { int ans = 0; for (int j = 0; j < 30; j++){ if (C[j] == cnt){ ans |= 1 << j; } } cout << ans << endl; } } } }