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 if x * y == 0 : print(max(x, y)) else : print(abs(x-y))