import sys if sys.platform =='ios': import clipboard a=clipboard.get() a = a.split('\n') text = '\n'.join(a) with open('input_file.txt','w') as f: f.write(text) sys.stdin = open('input_file.txt') n = int(input()) x = list(map(int,input().split())) even = 0 odd = 0 for i in x: if i%2 == 0: even += 1 else: odd += 1 if even == odd: print(0) else: print(abs(even-odd))