n = int(raw_input()) l = map(int, raw_input().split()) e = 0 o = 0 for i in l: if i % 2 == 0: e += 1 else: o += 1 print abs(e-o)