n=int(input()) num1=num2=0 for i in map(int,input().split()): if i%2==0: num1+=1 else: num2+=1 print(abs(num1-num2))