n=int(input()) x=input() xi=x.split() e=0 o=0 xs=len(xi) for i in range(0,xs): a=int(xi[i]) if(a%2==0): e+=1 else: o+=1 y=e-o if y<0: y*=-1 print(y)