N = int(input()) X = list(map(int,input().split())) P = 0 Q = 0 for i in range(N): if X[i] % 2: P += 1 else: Q += 1 print(N - (min(P, Q) * 2))