#cook your dish here
def show(t):
    a = list(map(int,input().rstrip().split()))
    e = 0
    o = 0
    for i in a:
        if (i & 1)==0:
            e = e + 1
        else:
            o = o + 1
    if ((e==o-1 or o==e-1) and (t%2!=0)) or ((e==0) and (t%2==0)):
        print("0")
    elif ((e==o-1 or o==e-1) and (t%2==0)) or ((e==0) and (t%2!=0)):
        print(t-1)
    elif e>o:
        print(e-o)
    else:
        print(o-e)
show(int(input()))