n = int(input()) P = list(map(int, input().split())) C = [0 for _ in range(2)] for i in range(n): C[P[i] % 2] += 1 print(abs(C[0] - C[1]))