N = int(input()) X = list(map(int, input().split())) odd = sum(x & 1 for x in X) even = N - odd ans = abs(odd - even) print(ans)