N = int(input()) X = list(map(int, input().split())) even = odd = 0 for x in X: if x % 2 == 0: even += 1 else: odd += 1 ans = abs(even - odd) print(ans)