N = int(input()) X = list(map(int, input().split())) c = [0, 0] for x in X: c[x&1] += 1 print(max(c)-min(c))