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