N = int(input()) X = list(map(int, input().split())) oc = sum(1 for x in X if x % 2 == 1) ec = sum(1 for x in X if x % 2 == 0) if oc % 2 == 1 and ec % 2 == 1: print(2) elif oc % 2 != 1 and ec % 2 != 1: print(0) else: print(1)