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