n=int(input()) A=list(map(int,input().split())) x,y=0,0 for a in A: if a%2==0: x+=1 else: y+=1 print(abs(x-y))