import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### m = 30 q = ni() p = [0] * m from collections import defaultdict k = 0 d = defaultdict(int) for _ in range(q): que = na() if que[0] == 1: x = que[1] if d[x] == 0: d[x] = 1 k += 1 for i in range(m): if x >> i & 1 ^ 1: p[i] += 1 elif que[0] == 2: x = que[1] if d[x] == 1: d[x] = 0 k-=1 for i in range(m): if x >> i & 1 ^ 1: p[i] -= 1 else: if k == 0: print(-1) exit() s = 0 for i in range(m): if p[i] == 0: s += 1<