N = int(raw_input()) X = map(int, raw_input().split()) oddcnt = 0 evencnt = 0 for i in range(0, N): if X[i] % 2 == 1: oddcnt += 1 else: evencnt += 1 print abs(oddcnt-evencnt)