N = int(input()) l = list(map(int, input().split())) if N % 2 == 0: count_odd = 0 count_even = 0 for li in l: if li % 2 == 0: count_even += 1 else: count_odd += 1 if count_even == count_odd: print(0) else: print(1) else: print(1)