n,odd,even=int(input()),0,0 for x in list(map(int,input().split(" "))): if x%2==0: even+=1 else: odd+=1 v=n-abs(even-odd) print(n-v)