N = int(input()) ans = [0] * 2 for i in map(int, input().split()): ans[i % 2] += 1 print(abs(ans[0] - ans[1]))