N=int(input()) X=list(map(int,input().split())) A=0 B=0 for x in X: if x%2==0: A+=1 else: B+=1 print(max(A,B)-min(A,B))