N=int(input()) X=list(map(int,input().split())) Odd=Even=0 for x in X: if x%2: Odd+=1 else: Even+=1 print(abs(Odd-Even))