N = int(input()) A = list(map(int, input().split())) cnt = 0 for a in A: if a < 0 and a % 2: cnt += 1 if cnt: print(1) if cnt % 2 else print(2) exit() M = 65 dp = [-1] * M dp[0] = 0 for i in range(M): S = set() for j in range(10): if (i >> j) & 1: S.add(dp[j]) now = 0 while now in S: now += 1 dp[i] = now ans = 0 for i in range(N): S = set() for j in range(M): if (A[i] >> j) & 1: S.add(dp[j]) now = 0 while now in S: now += 1 ans ^= now print(1) if ans else print(2)