import sys input = sys.stdin.readline from collections import * flag = defaultdict(int) cnt = 0 bit = [0]*30 for _ in range(int(input())): qs = list(map(int, input().split())) if qs[0]==1: x = qs[1] if flag[x]==0: flag[x] = 1 cnt += 1 for b in range(30): if (x>>b)&1: bit[b] += 1 elif qs[0]==2: x = qs[1] if flag[x]==1: flag[x] = 0 cnt -= 1 for b in range(30): if (x>>b)&1: bit[b] -= 1 else: if cnt==0: print(-1) else: ans = 0 for b in range(30): if bit[b]==cnt: ans += 1<