# 11723번. 집합
importsysinput=sys.stdin.readlinedefadd(s,x):ifxnotins:s.append(x)defremove(s,x):ifxins:s.remove(x)defcheck(s,x):ifxins:return1else:return0deftoggle(s,x):ifxins:s.remove(x)else:s.append(x)defall(s):s=[iforiinrange(1,21)]returnsdefempty(s):s=[]returnss=[]a=[]foriinrange(int(input())):ip=input().rstrip()ifip=='all':s=all(s)elifip=='empty':s=empty(s)else:c,x=ip.split()x=int(x)ifc=='add':add(s,x)elifc=='remove':remove(s,x)elifc=='check':print(check(s,x))elifc=='toggle':toggle(s,x)# print(a)