n = int(input()) ls = input().split() e = 0 o = 0 for i in ls: if int(i) % 2 == 0: e += 1 else: o += 1 print(abs(e-o))