n = int(input()) a = [0, 0] for i in map(lambda x: int(x) + 10000000000, input().split()): a[i % 2] += 1 print(abs(a[0] - a[1]))