N = int(input()) c = 0 for i in list(map(int,input().split())): if i%2 == 0: c += 1 else: c -= 1 print(abs(c))