n = int(input()) x = list(map(int, input().split())) e = len([i for i in x if i % 2 == 0]) o = n - e print(abs(e-o))