N=int(input()) X=list(map(int,input().split())) X=[x%2 for x in X] print(N-2*min(X.count(0),X.count(1)))