# No.99 ジャンピング駒 n = int(input()) x = [int(i) for i in input().split()] count_even = 0 count_odd = 0 for i in x: if i % 2 == 0: count_even += 1 else: count_odd += 1 print(abs(count_even - count_odd))