N=int(input()) count=0 A=list(map(int,input().split())) for i in range(N): if A[i]<0: count+=1 if count>=2: P=[0] print(P[1]) print(0) elif count==1: print(1) else: grandy=[0]*64 for x in range(1,64): B=set() for k in range(10): if (x>>k)&1: B.add(grandy[k]) for y in range(64): if not y in B: grandy[x]=y break result=0 for i in range(N): x=A[i] B=set() for k in range(64): if (x>>k)&1: B.add(grandy[k]) for y in range(64): if not y in B: result^=y break if result==0: print(2) else: print(1)