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