n = int(input()) xs = map(int, input().split()) co, ce = 0, 0 for x in xs: if x % 2 == 0: ce += 1 else: co +=1 print(abs(co - ce))