N = int(input()) A = list(map(int,input().split())) x = 0 y = 0 for a in A : if a % 2 == 0 : x += 1 else : y += 1 print(abs(x-y))