N = int(input()) X = map(int, input().split()) even = sum(e % 2 == 0 for e in X) odd = N - even print(N - min(even, odd) * 2)