N = int(raw_input()) arr = map(int, raw_input().split()) ans = [0,0] for i in arr: if i % 2 == 0: ans[0] += 1 else: ans[1] += 1 print max(ans) - min(ans)