counter = [0, 0] num = int(input()) li = [int(x) for x in input().split(" ")] for x in li: if x % 2 == 1: counter[0] += 1 else: counter[1] += 1 print(abs(counter[0] - counter[1]))