n=int(input()) l=list(map(int,input().split())) a=0;b=0 for i in range(n): if l[i]%2==0: a+=1 else: b+=1 print(abs(a-b))