n=input() def p2(x):y=int(x)%2;return y l=list(map(p2,input().split())) print(abs(l.count(0)-l.count(1)))