import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # 偶奇が両方あれば、必ず消せることがわかる N,*A = map(int,read().split()) od = sum(x&1 for x in A) ev = N - od x = min(od, ev) answer = N - 2 * x print(answer)