n = int(input()) a = list(map(int, input().split())) cnt_even = 0 cnt_odd = 0 for i in range(n): if a[i] % 2 == 0: cnt_even += 1 else: cnt_odd += 1 print(abs(cnt_even - cnt_odd))