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