n=int(input()) x=[int(x) for x in input().split()] even=[i for i in x if i%2==0] odd=[i for i in x if i%2==1] print(abs(len(even)-len(odd)))