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