N = int(input()) L = list(map(int, input().split())) A = len([a for a in L if a % 2 == 0]) B = N - A print([abs(B-A), 0][A == B])