n = int(input()) x = list(map(int, input().split())) x.sort() has_adjacent = False for i in range(n - 1): if x[i+1] - x[i] == 1 and (x[i] % 2 != x[i+1] % 2): has_adjacent = True break even = 0 odd = 0 for num in x: if num % 2 == 0: even += 1 else: odd += 1 if has_adjacent: print((even + odd) % 2) else: print((even % 2) + (odd % 2))