You are given $n$ chips on a number line. The $i$-th chip is placed at the integer coordinate $x_i$. Some chips can have equal coordinates.

You can perform each of the two following types of moves any (possibly, zero) number of times on any chip:

  Move the chip $i$ by $2$ to the left or $2$ to the right for free (i.e. replace the current coordinate $x_i$ with $x_i - 2$ or with $x_i + 2$);  move the chip $i$ by $1$ to the left or $1$ to the right and pay one coin for this move (i.e. replace the current coordinate $x_i$ with $x_i - 1$ or with $x_i + 1$). 

Note that it's allowed to move chips to any integer coordinate, including negative and zero.

Your task is to find the minimum total number of coins required to move all $n$ chips to the same coordinate (i.e. all $x_i$ should be equal after some sequence of moves).


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 100$) — the number of chips.

The second line of the input contains $n$ integers $x_1, x_2, \dots, x_n$ ($1 \le x_i \le 10^9$), where $x_i$ is the coordinate of the $i$-th chip.


-----Output-----

Print one integer — the minimum total number of coins required to move all $n$ chips to the same coordinate.


-----Examples-----
Input
3
1 2 3

Output
1

Input
5
2 2 2 3 3

Output
2



-----Note-----

In the first example you need to move the first chip by $2$ to the right and the second chip by $1$ to the right or move the third chip by $2$ to the left and the second chip by $1$ to the left so the answer is $1$.

In the second example you need to move two chips with coordinate $3$ by $1$ to the left so the answer is $2$.

Difficulty: EASY

Solutions:
n = int(input())
arr = list(map(int, input().split()))
minn = 1000000000
for i in arr:
	c = 0
	for j in arr:
		if abs(j - i) % 2 == 1:
			c += 1
	minn = min(minn, c)
print(minn)


n = int(input())
values = [int(x) for x in input().split()]
odds = 0
evens = 0
for x in values:
	if x % 2 == 0:
		evens += 1
	else:
		odds += 1
print(min(odds, evens))


n = int(input())
x_i = input()
x_i_array = x_i.split(' ')
x_i_int_array = []
for i in x_i_array:
	x_i_int_array.append(int(i))
count_odd = 0
count_even = 0
for i in x_i_int_array:
	if abs(i) % 2 == 0:
		count_even += 1
	else:
		count_odd += 1
answer = min(count_odd, count_even)
print(answer)


N = int(input())
L = list(map(int, input().split()))
p = 0
d = 0
for l in L:
	if l % 2 == 0:
		p += 1
	else:
		d += 1
c = min(p, d)
print(c)


n = int(input())
a = [int(x) % 2 for x in input().split()]
ans = min(a.count(1), a.count(0))
print(ans)


a = int(input())
b = list(map(int, input().split()))
k = 0
for i in range(a):
	if b[i] % 2 == 0:
		k += 1
print(min(a - k, k))


numbers = int(input())
lista = input().split(' ')
impar = 0
par = 0
for i in range(0, len(lista)):
	lista[i] = int(lista[i])
	if lista[i] % 2 == 0:
		impar = impar + 1
	else:
		par = par + 1
if par > impar:
	print(impar)
else:
	print(par)


a = int(input())
b = list(map(int, input().split()))
count = 0
count1 = 0
for i in range(a):
	if b[i] % 2 != 0:
		count += 1
	else:
		count1 += 1
print(min(count1, count))


coin = 0
coin1 = 0
n = int(input())
x = [int(x) for x in input().split()]
x.sort()
mid = n // 2
mid1 = n // 2 + 1
for i in range(n):
	if abs(x[i] - mid) % 2 != 0:
		coin += 1
	if abs(x[i] - mid1) % 2 != 0:
		coin1 += 1
print(min(coin, coin1))


n = int(input())
l = list(map(int, input().split()))
c = 0
for i in l:
	if i % 2 == 0:
		c += 1
print(min(n - c, c))


t1 = 0
t2 = 0
int(input(''))
for i in list(map(int, input().split())):
	if i % 2:
		t1 += 1
	else:
		t2 += 1
print(min(t1, t2))


n = int(input())
arr = list(map(int, input().split()))
res = 0
for i in arr:
	if i & 1:
		res = res + 1
print(min(res, n - res))


n = int(input())
a = [int(x) for x in input().split()]
b = list(filter(lambda x: x % 2 == 0, a))
c = len(b)
print(min(c, n - c))


n = int(input())
o = 0
for x in map(int, input().split()):
	o += x % 2
print(min(o, n - o))


n = int(input())
x = 0
y = 0
a = input().split()
for i in a:
	if int(i) % 2:
		x = x + 1
	else:
		y = y + 1
print(min(x, y))


n = int(input())
a = [int(x) for x in input().split()]
c1 = 0
c2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		c1 += 1
	else:
		c2 += 1
if c1 < c2:
	small = c1
else:
	small = c2
print(small)


input()
chips = [int(x) % 2 for x in input().split()]
chipo = sum(chips)
chipe = len(chips) - chipo
print(min(chipo, chipe))


a = int(input())
b = list(map(int, input().split()))
even = 0
for element in b:
	if element % 2 == 0:
		even = even + 1
odd = a - even
print(min(odd, even))


n = int(input())
x = list(map(int, input().split()))
even = len([a for a in x if a % 2 == 0])
print(min(n - even, even))


input()
eo = [0, 0]
for num in map(int, input().split()):
	if num % 2 == 0:
		eo[0] += 1
	else:
		eo[1] += 1
print(min(eo))


n = int(input())
x = list(map(int, input().split()))
(cp, ci) = (0, 0)
for xi in x:
	if xi % 2 == 0:
		cp += 1
	else:
		ci += 1
print(min([cp, ci]))


n = int(input())
a = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		count1 += 1
	else:
		count2 += 1
print(min(count1, count2))


n = int(input())
a = list(map(int, input().split()))
cnt = [0] * n
for i in range(n):
	for j in range(n):
		if abs(a[j] - a[i]) % 2 == 1:
			cnt[i] += 1
ans = min(cnt)
print(ans)


n = int(input())
a = list(map(int, input().split()))
p = 0
u = 0
for i in range(n):
	if a[i] % 2 == 0:
		p += 1
	else:
		u += 1
print(min(u, p))


def main():
	n = int(input())
	a = list(map(int, input().split()))
	(odd, even) = (0, 0)
	for k in a:
		if k % 2 == 0:
			odd += 1
		else:
			even += 1
	print(min(odd, even))
main()


n = int(input())
a = [int(x) for x in input().split()]
mins = 10 ** 18
for i in range(n):
	s = 0
	for j in range(n):
		s += abs(a[j] - a[i]) % 2
	if s < mins:
		mins = s
print(mins)


n = int(input())
l = list(map(int, input().split(' ')))
d = {}
c = []
cnt = 0
d = []
for i in range(len(l)):
	for j in range(len(l)):
		c.append(l[i] - l[j])
	for i in c:
		if i % 2 != 0:
			cnt = cnt + 1
	c = []
	d.append(cnt)
	cnt = 0
mini = 0
for i in d:
	if i != 0:
		mini = i
		break
if mini == 0:
	print(0)
else:
	for i in d:
		if i < mini:
			mini = i
	print(mini)


n = map(int, input())
lst = list(map(int, input().split()))
odd = 0
even = 0
for i in range(len(lst)):
	if lst[i] % 2 != 0:
		odd += 1
	else:
		even += 1
if odd > even:
	print(even)
else:
	print(odd)


n = int(input())
txt = input()
L = txt.split(' ')
L = list(map(int, L))
i = 0
p = 0
for elt in L:
	if elt % 2 == 0:
		p += 1
	else:
		i += 1
print(min(i, p))


import sys
import math
from collections import defaultdict
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c1 = 0
c2 = 0
for x in a:
	if x % 2 == 0:
		c2 += 1
	else:
		c1 += 1
print(min(c1, c2))


n = int(input())
(a, b) = (0, 0)
for i in input().split():
	if int(i) % 2 == 0:
		a += 1
	else:
		b += 1
if a == b:
	print(b)
elif a > b:
	print(b)
else:
	print(a)


n = int(input())
co = 0
ce = 0
arr = [int(x) for x in str(input()).split()]
for i in arr:
	if i % 2 == 1:
		co += 1
	else:
		ce += 1
print(min(co, ce))


n = int(input())
num = [int(x) for x in input().split()]
p = len(num)
s = 0
t = 0
for i in range(0, p):
	if num[i] % 2 == 0:
		s += 1
	else:
		t += 1
print(min(s, t))


n = int(input())
num = input()
a = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr = get_the_data(0, num, a)
odd = 0
even = 0
num = 0
for i in arr:
	if abs(i) % 2 == 1:
		odd += 1
	else:
		even += 1
if odd > even:
	for i in arr:
		if i % 2 == 1:
			num = i
			break
else:
	for i in arr:
		if i % 2 == 0:
			num = i
			break
price = 0
for i in arr:
	if i != num:
		diff = abs(num - i)
		if diff % 2 == 1:
			price += 1
print(price)


n = input()
items = [int(i) for i in input().split()]
(y, n) = (0, 0)
for i in items:
	if i % 2 == 0:
		y += 1
	else:
		n += 1
print(min(y, n))


n = int(input())
arr = [int(k) for k in input().split()]
odd = 0
even = 0
for i in range(n):
	if arr[i] % 2 == 0:
		even += 1
	else:
		odd += 1
if even >= odd:
	count = 0
	for i in range(n):
		if arr[i] % 2 != 0:
			count += 1
	print(count)
else:
	count = 0
	for i in range(n):
		if arr[i] % 2 == 0:
			count += 1
	print(count)


n = int(input())
X = [int(x) for x in input().split()]
even = 0
odd = 0
for x in range(n):
	if X[x] % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


n = int(input())
a = list(map(int, input().split()))
coin = 0
avg = sum(a) // len(a)
first = a[0]
odd = 0
even = 0
for i in range(0, len(a)):
	if a[i] % 2 == 1:
		odd += 1
	else:
		even += 1
if odd >= even:
	print(even)
else:
	print(odd)


n = int(input())
l = list(map(int, input().split()))
z = []
for i in range(n):
	c = l[i]
	sum = 0
	for j in range(n):
		if abs(l[j] - c) % 2 != 0:
			sum += 1
	z.append(sum)
print(min(z))


n = int(input())
l = list(map(int, input().split(' ')))
m = len(l)
odd = [num for num in l if num % 2 == 1]
o = len(odd)
e = m - o
print(min(o, e))


n = int(input())
l = [*map(int, input().split())]
res = float('inf')
for i in range(n):
	coin = 0
	for j in range(n):
		if l[i] % 2 != l[j] % 2:
			coin += 1
	res = min(res, coin)
print(res)


n = int(input())
g = list(map(int, input().split()))
r = 999999999999
for i in range(n):
	t = 0
	for j in range(n):
		if abs(g[i] - g[j]) % 2 == 1:
			t = t + 1
	if t < r:
		r = t
print(r)


test = int(input())
l = [int(i) for i in input().split(' ')]
odd = 0
even = 0
for i in l:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
val = min(odd, even)
print(val)


from math import *
n = int(input())
a = list(map(int, input().split()))
c = 0
min = n
for i in range(n):
	for j in range(n):
		c = c + abs(a[j] - a[i]) % 2
	if c < min:
		min = c
	c = 0
print(min)


n = int(input())
lst = list(map(int, input().strip().split(' ')))
c_odd = 0
c_even = 0
for i in range(n):
	if lst[i] % 2 == 0:
		c_even += 1
	else:
		c_odd += 1
print(min(c_odd, c_even))


input()
a = list(map(int, input().split()))
odd_even = [0, 0]
for i in a:
	odd_even[i % 2] += 1
print(min(odd_even))


n = int(input())
l = list(map(int, input().split()))
c1 = 0
c2 = 0
x = max(l)
for i in range(len(l)):
	if (x - l[i]) % 2 != 0:
		c1 = c1 + 1
	else:
		c2 = c2 + 1
print(min(c1, c2))


n = int(input())
x = input().split()
f = 0
z = 0
for i in x:
	if int(i) % 2 == 0:
		z += 1
	else:
		f += 1
print(min(f, z))


n = int(input())
a = list(map(int, input().split()))
(even_cnt, odd_cnt) = (0, 0)
for x in a:
	if x % 2 == 0:
		even_cnt += 1
	else:
		odd_cnt += 1
print(min(even_cnt, odd_cnt))


n = int(input())
a = list(map(int, input().split()))
b = {}
for i in a:
	if i in b:
		b[i] += 1
	else:
		b[i] = 1
l = float('inf')
for i in b:
	t = 0
	for j in b:
		t += (j - i) % 2 * b[j]
	if t < l:
		l = t
print(l)


n = int(input())
A = list(map(int, input().split()))
c = 0
for i in range(0, n):
	if A[i] % 2 != 0:
		c = c + 1
print(min(c, n - c))


n = int(input())
data = [int(i0) for i0 in input().split()]
k = sum([i % 2 for i in data])
print(min(k, n - k))


n = int(input())
l = list(map(int, input().split()))
(e, o) = (0, 0)
for i in l:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
if e >= o:
	print(o)
else:
	print(e)


numEven = 0
numOdd = 0
num = int(input())
lol = input().split(' ')
for x in range(0, len(lol)):
	if int(lol[x]) % 2 == 0:
		numOdd = numOdd + 1
	else:
		numEven = numEven + 1
if numEven < numOdd:
	print(numEven)
else:
	print(numOdd)


input()
chipArray = list(map(int, input().split()))
cE = 0
cO = 0
for x in chipArray:
	if x % 2 == 0:
		cE += 1
	else:
		cO += 1
if cE > cO:
	print(cO)
else:
	print(cE)


n = int(input())
num = [0, 0]
for val in input().split():
	num[int(val) % 2] += 1
print(min(num))


n = int(input())
arr = list(map(int, input().strip().split()))
ans1 = 0
ans2 = 0
for x in arr:
	if x % 2 != 0:
		ans1 += 1
	else:
		ans2 += 1
print(min(ans1, ans2))


n = int(input())
coord = list(map(int, input().split()))
ans = n
for i in coord:
	s = 0
	for j in coord:
		if abs(i - j) % 2 != 0:
			s += 1
	if s < ans:
		ans = s
print(ans)


__author__ = 'tiffanislutsky'
n = int(input())
nums = input().split(' ')
ev = 0
for i in nums:
	if int(i) % 2 == 0:
		ev = ev + 1
odd = n - ev
small = min(odd, ev)
print(str(small))


def main():
	n = int(input())
	v = [int(x) for x in input().split()]
	s1 = 0
	s2 = 0
	for x in v:
		if x % 2 == 0:
			s1 += 1
		else:
			s2 += 1
	print(min(s1, s2))
main()


_ = input()
x = list(map(int, input().split()))
print(min(len(list(filter(lambda x: x % 2, x))), len(list(filter(lambda x: x % 2 == 0, x)))))


m = input()
n = input()
c1 = 0
c2 = 0
k = n.split(' ')
for mm in k:
	if int(mm) % 2 == 0:
		c1 += 1
	else:
		c2 += 1
if c1 > c2:
	print(c2)
else:
	print(c1)


n = int(input())
a = list(map(int, input().split()))
cntodd = 0
for i in range(n):
	if a[i] % 2:
		cntodd += 1
print(min(cntodd, n - cntodd))


input()
p = list(map(int, input().split()))
q = [0, 0]
for i in range(len(p)):
	if p[i] % 2:
		q[1] += 1
	else:
		q[0] += 1
print(min(q))


n = int(input())
xs = list(map(int, input().split()))
evens = 0
odds = 0
for x in xs:
	if x % 2:
		odds += 1
	else:
		evens += 1
if odds and evens:
	print(min(odds, evens))
else:
	print(0)


n = int(input())
s = [int(x) for x in input().split()]
odd = 0
even = 0
for x in s:
	if x % 2 == 0:
		odd += 1
	else:
		even += 1
if odd > even:
	print(even)
else:
	print(odd)


n = int(input())
x = list(map(int, input().split()))
res = 1e+18
for i in range(n):
	res1 = 0
	for j in range(n):
		if abs(x[j] - x[i]) % 2 == 1:
			res1 += 1
	if res1 < res:
		res = res1
print(res)


n = int(input())
A = [int(x) for x in input().split()]
cntEven = 0
cntOdd = 0
for i in A:
	if i % 2 == 0:
		cntEven += 1
	else:
		cntOdd += 1
if cntEven and cntOdd:
	print(min(cntEven, cntOdd))
else:
	print(0)


n = int(input())
x = list(map(int, input().split()))
k = 0
for i in range(n):
	if x[i] % 2 == 1:
		k += 1
print(min(k, n - k))


n = int(input())
odd_count = 0

def odd_num(*args):
	global odd_count
	for arg in args:
		if int(arg) % 2 != 0:
			odd_count += 1
		return int(arg)
x = list(map(odd_num, input().split()))
print(min(odd_count, n - odd_count))


n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
	a[i] %= 2
	ans += a[i]
print(min(n - ans, ans))


from sys import stdin, stdout
import bisect
import math

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def soe(limit):
	l = [1] * (limit + 1)
	prime = []
	for i in range(2, limit + 1):
		if l[i]:
			for j in range(i * i, limit + 1, i):
				l[j] = 0
	for i in range(2, limit + 1):
		if l[i]:
			prime.append(i)
	return prime

def segsoe(low, high):
	limit = int(high ** 0.5) + 1
	prime = soe(limit)
	n = high - low + 1
	l = [0] * (n + 1)
	for i in range(len(prime)):
		lowlimit = low // prime[i] * prime[i]
		if lowlimit < low:
			lowlimit += prime[i]
		if lowlimit == prime[i]:
			lowlimit += prime[i]
		for j in range(lowlimit, high + 1, prime[i]):
			l[j - low] = 1
	for i in range(low, high + 1):
		if not l[i - low]:
			if i != 1:
				print(i)

def power(a, n):
	r = 1
	while n:
		if n & 1:
			r = r * a
			n = n - 1
		else:
			a = a * a
			n = n >> 1
	return r

def occur(l, x):
	for i in range(len(l)):
		if l[i] == x:
			return i

def solve():
	n = inp()
	l = li()
	x = []
	s = list(set(l))
	for i in s:
		ss = 0
		for j in l:
			ss += abs(i - j) % 2
		x.append(ss)
	print(min(x))
for _ in range(1):
	solve()


n = int(input())
a = list(map(int, input().split()))
n_odds = 0
for i in a:
	n_odds += i & 1
print(min(n_odds, n - n_odds))


def main():
	input()
	all_nums = map(int, input().split(' '))
	odd_count = 0
	even_count = 0
	for num in all_nums:
		if num % 2 == 0:
			even_count += 1
		else:
			odd_count += 1
	print(min(even_count, odd_count))
main()


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
c1 = 0
c2 = 0
a = li()
for i in range(n):
	if a[i] % 2:
		c1 += 1
	else:
		c2 += 1
print(min(c1, c2))


n = int(input())
a = list(map(int, input().split()))
c = []
for i in range(n):
	z = a[i]
	y = []
	for j in range(n):
		x = abs(z - a[j])
		if x % 2 != 0:
			y.append(x % 2)
	c.append(y)
d = []
for i in range(len(c)):
	d.append(c[i].count(1))
print(min(d))


n = int(input())
arr = list(map(int, input().split()))
ans = 10 ** 9
for i in range(len(arr)):
	cost = 0
	for j in range(len(arr)):
		dist = abs(arr[i] - arr[j])
		cost += dist % 2
	ans = min(ans, cost)
print(ans)


n = int(input())
arr = list(map(int, input().split()))
count = 0
counter = 0
coins = 0
for i in range(n):
	if arr[i] % 2 == 0:
		count += 1
	else:
		counter += 1
if count > counter:
	coins = counter
else:
	coins = count
print(coins)


n = int(input())
even = 0
odd = 0
a = list(map(int, input().split()))
for i in range(n):
	if a[i] % 2 == 0:
		even += 1
	else:
		odd += 1
ans = min(even, odd)
print(ans)


from collections import deque, defaultdict

def main():
	N = int(input())
	nums = defaultdict(int)
	odd = deque()
	even = deque()
	for x in list(map(int, input().split())):
		if x in nums:
			nums[x] += 1
		else:
			nums[x] = 1
	for n in nums:
		if n % 2:
			odd.append(nums[n])
		else:
			even.append(nums[n])
	odd = deque(sorted(odd, reverse=True))
	even = deque(sorted(even, reverse=True))
	print(min([sum(odd), sum(even)]))
main()


n = int(input())
arr_x = list(map(int, input().split()))
(even, odd) = (0, 0)
for i in arr_x:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
x = list(map(int, input().split(' ')))
even = 0
odds = 0
for i in x:
	if i % 2 == 0:
		even += 1
	else:
		odds += 1
print(min(even, odds))


n = int(input())
a = [int(i) for i in input().split()]
c = 0
x = a[0]
for i in range(1, n):
	if (a[i] - x) % 2 == 1:
		c += 1
print(min(c, n - c))


x = int(input())
even = 0
odd = 0
n = []
for x in map(int, input().split()):
	n.append(x)
	if x % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
x = list(map(int, input().split()))
odd = 0
for i in range(len(x)):
	if x[i] % 2 != 0:
		odd += 1
even = len(x) - odd
print(min(odd, even))


n = input()
n = int(n)
l = list(map(int, input().split()))
count = 0
for i in range(n):
	if l[i] % 2 == 0:
		count += 1
print(min(count, n - count))


n = int(input())
a = [int(i) for i in input().split()]
eve_c = 0
odd_c = 0
for i in range(n):
	if a[i] % 2:
		odd_c += 1
	else:
		eve_c += 1
if eve_c >= odd_c:
	print(odd_c)
else:
	print(eve_c)


n = int(input())
chips = map(int, input().split())
(odd, even) = (0, 0)
for i in chips:
	if i % 2 == 1:
		odd += 1
	else:
		even += 1
	k = min(odd, even)
print(k)


n = int(input())
arr = [int(i) for i in input().split()]
mn = int(1000000000.0)
for i in arr:
	ans = int(0)
	for j in arr:
		if abs(i - j) % 2 == 1:
			ans += 1
	mn = min(ans, mn)
print(mn)


import os
a = int(input())
b = sum((int(x) % 2 for x in input().split()))
print(min(b, a - b))


a = int(input())
n = list(map(int, input().split()))
d = 0
for i in n:
	if i % 2 != 0:
		d += 1
print(min(d, a - d))


import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
Arr = get_array()
store = []
for i in Arr:
	store.append(i)
mini = 10 ** 9 + 7
for i in Arr:
	total = 0
	for j in range(n):
		total += abs(i - store[j]) % 2
	mini = min(mini, total)
print(mini)


n = int(input())
x = list((int(ch) % 2 for ch in input().split()))
cnt_0 = x.count(0)
cnt_1 = x.count(1)
print(min(cnt_0, cnt_1))


input()
even = odd = 0
for x in map(int, input().split()):
	if x % 2:
		odd += 1
	else:
		even += 1
print(min(even, odd))


n = int(input())
array = [int(x) for x in input().split()]
oddSum = 0
pairSum = 0
for elem in array:
	if elem % 2 == 0:
		pairSum += 1
	else:
		oddSum += 1
if pairSum > oddSum:
	print(oddSum)
else:
	print(pairSum)


n = int(input())
X = [int(i) for i in input().split()]
a = 0
b = 0
for i in range(n):
	if X[i] % 2 == 0:
		a += 1
	else:
		b += 1
if a > b:
	print(b)
else:
	print(a)


import math
n = int(input())
a = list(map(int, input().split()))
c = 0
for x in a:
	if x % 2:
		c += 1
print(min(c, n - c))


n = int(input())
nums = list(map(int, input().split()))
odd = 0
even = 0
for n in nums:
	if n % 2 == 0:
		even += 1
	else:
		odd += 1
if odd > even:
	print(even)
else:
	print(odd)


n = int(input())
num = list(map(int, input().split()))
num.sort()
size = n / 2
ans = 0
ans1 = 0
for i in range(0, n):
	if num[i] % 2 == 0:
		ans = ans + 1
	else:
		ans1 = ans1 + 1
print(min(ans, ans1))


n = int(input())
m = sum((int(x) % 2 for x in input().split()))
print(min(m, n - m))


dp = [0, 0]
n = int(input())
x = [*map(int, input().split())]
for i in x:
	dp[i % 2] += 1
print(min(dp))


n = int(input())
x = [int(xi) for xi in input().split()]
mod0 = 0
mod1 = 0
for i in x:
	if i % 2 == 0:
		mod0 += 1
	else:
		mod1 += 1
print(min(mod0, mod1))


n = int(input())
a = list(map(int, input().split()))
b = []
count = 0
for x in a:
	count = 0
	for y in a:
		if abs(y - x) == 0:
			pass
		if abs(y - x) == 1:
			count += 1
		if abs(y - x) == 2:
			pass
		if abs(y - x) >= 3:
			count += (y - x) % 2
	b.append(count)
print(min(b))


n = int(input())
a = [int(s) for s in input().split()]
cnt = 0
for i in a:
	if i % 2:
		cnt += 1
print(min(cnt, n - cnt))


n = int(input())
x = [int(n) for n in input().split()]
c1 = 0
c0 = 0
for i in x:
	if i & 1:
		c0 += 1
	else:
		c1 += 1
print(min(c0, c1))


n = int(input())
x = list(map(int, input().split()))
for i in range(n):
	x[i] = x[i] % 2
print(min(x.count(0), x.count(1)))


a = int(input())
b = [int(i) % 2 for i in input().split()]
print(min(b.count(1), b.count(0)))


num = int(input())
a = []
i = input()
a = list(map(int, i.split()))
out = 0
evens = 0
for o in a:
	if o % 2 == 0:
		evens = evens + 1
odds = len(a) - evens
if odds > evens:
	out = evens
else:
	out = odds
print(out)


n = int(input())
vals = [0, 0]
for num in map(int, input().split()):
	vals[num % 2] += 1
print(min(vals))


input()
lst = list(map(int, input().split()))
print(min(len(list(filter(lambda x: x % 2 == 0, lst))), len(list(filter(lambda x: x % 2 == 1, lst)))))


n = int(input())
s = map(int, input().split())
od = 0
ev = 0
for i in s:
	if i % 2 == 0:
		ev = ev + 1
	else:
		od = od + 1
if od > ev:
	print(ev)
else:
	print(od)


import math
t = int(input())
arr = list(map(int, input().split()))
even = 0
odd = 0
for i in range(len(arr)):
	if arr[i] % 2 == 0:
		even += 1
	else:
		odd += 1
if even >= odd:
	print(odd)
else:
	print(even)


q = int(input())
w = list(map(int, input().split()))
e = 0
r = 0
for i in range(q):
	if w[i] % 2 == 0:
		e += 1
	else:
		r += 1
print(min(e, r))


n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 1000000000
for s in range(n):
	oneloop = 0
	for i in range(n):
		oneloop += abs(a[i] - a[s]) % 2
	res = min(oneloop, res)
print(res)


garbage = int(input())
a = list(map(int, input().rstrip().split(' ')))
count_odd = 0
count_even = 0
for ai in a:
	if ai % 2:
		count_odd += 1
	else:
		count_even += 1
print(min(count_even, count_odd))


import sys
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
n = int(input())
l = list(map(int, input().split()))
c = 0
for i in l:
	if i % 2:
		c += 1
print(min(c, n - c))


n = int(input())
l = [int(x) for x in input().split()]
v = []
for i in range(n):
	d = l[i] % 2
	v.append(d)
print(min(v.count(1), v.count(0)))


n = int(input())
ar = list(map(int, input().split()))
s_0 = 0
s_1 = 0
for i in ar:
	if i % 2 == 0:
		s_0 += 1
	else:
		s_1 += 1
print(min(s_0, s_1))


import sys
from statistics import mean
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
li = inlt()
o = 0
e = 0
for i in range(n):
	if li[i] % 2 == 0:
		e = e + 1
	else:
		o = o + 1
print(min(e, o))


n = int(input())
a = [0, 0]
for i in map(int, input().split()):
	a[i % 2] += 1
print(min(a))


from sys import stdin

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
n = ii()
a = li()
x = 0
for i in a:
	x += i % 2
print(min(x, n - x))


import sys
n = int(input().strip())
a = [int(x) for x in input().strip().split(' ')]
s = list(set(a))
c = 0
ans = sys.maxsize
for i in s:
	c = 0
	for j in range(n):
		r = abs(i - a[j]) % 2
		c += r
	ans = min(ans, c)
print(ans)


def readInts():
	return [int(x) for x in input().split()]
N = int(input())
xs = readInts()
num_odd = 0
num_even = 0
for x in xs:
	if x % 2 == 0:
		num_even += 1
	else:
		num_odd += 1
print(min(num_odd, num_even))


num_chips = int(input())
coords = [int(x) for x in input().split(' ')]
ans = float('inf')
num_even = 0
num_odds = 0
for x in coords:
	if x % 2 == 0:
		num_even += 1
	else:
		num_odds += 1
ans = min(num_even, num_odds)
print(ans)


n = int(input())
odd = sum((int(i) % 2 == 1 for i in input().split()))
print(min(odd, n - odd))


n = int(input())
a = [int(i) for i in input().split()]
s1 = 0
s2 = 0
for x in a:
	if x % 2 == 0:
		s1 += 1
	else:
		s2 += 1
print(min(s1, s2))


n = int(input())
a = list(map(int, input().split()))
c1 = c2 = 0
for i in a:
	if i % 2 == 0:
		c1 += 1
	else:
		c2 += 1
print(min(c1, c2))


n = int(input())
evens = 0
odds = 0
nums = input().split(' ')
for i in range(n):
	num = int(nums[i])
	if num % 2 == 0:
		evens += 1
	else:
		odds += 1
print(min(evens, odds))


T = int(input())
l = list(map(int, input().split()))
arr = []
for i in range(T):
	arr.append([])
for i in range(T):
	for j in range(T):
		arr[i].append(abs(l[i] - l[j]))
k = []
for i in range(T):
	k.append(0)
for j in range(T):
	for i in range(T):
		k[j] += arr[j][i] % 2
print(min(k))


n = int(input())
arr = list(map(lambda x: int(x) % 2 == 0, input().split()))
evens_num = arr.count(True)
if evens_num > n // 2:
	print(n - evens_num)
else:
	print(evens_num)


_ = int(input())
v = map(int, input().split())
evens = 0
odds = 0
for i in v:
	if i % 2 == 0:
		evens += 1
	else:
		odds += 1
print(min(evens, odds))


s = input()
A = [int(i) for i in input().split()]
R = [0] * len(A)
S = [0] * len(A)
for i in range(len(A)):
	R[i] = A[i] % 2
for i in range(len(A)):
	if R[i] == 0:
		S[i] = 1
print(min(sum(S), sum(R)))


n = int(input())
arr = list(map(int, input().split()))
l = [0] * 101
for i in arr:
	l[i % 100] += 1
(s1, s2) = (0, 0)
for i in range(len(l)):
	if i % 2:
		s1 += l[i]
	else:
		s2 += l[i]
print(min(s1, s2))


x = input()
lista = list(map(int, input().split()))
par = 0
impar = 0
for i in lista:
	if i % 2 == 0:
		par += 1
	else:
		impar += 1
if par >= impar:
	print(impar)
else:
	print(par)


def main():
	num_chips = int(input())
	chips = [int(x) % 2 for x in input().split(' ')]
	ones = len([x for x in chips if x == 1])
	zeros = len([x == 0 for x in chips if x == 0])
	if zeros > ones:
		print(ones)
	else:
		print(zeros)
main()


n = int(input())
arr = list(map(int, input().split()))
(eve, odd) = (0, 0)
for i in arr:
	if i % 2 == 0:
		eve += 1
	else:
		odd += 1
print(min(odd, eve))


n = int(input())
x = input()
ax = []
ax = list(x.split(' '))
aix = []
for i in range(len(ax)):
	aix.append(int(ax[i]))
aex = []
aox = []
for i in range(n):
	if aix[i] % 2 == 0:
		aex.append(aix[i])
	else:
		aox.append(aix[i])
ael = len(aex)
aol = len(aox)
m = min(ael, aol)
print(m)


n = int(input())
s = sum(map(lambda x: int(x) % 2, input().split()))
print(min(s, n - s))


n = int(input())
x = [int(s) for s in input().split()]
chet = 0
nechet = 0
for i in x:
	if i % 2 == 0:
		chet += 1
	else:
		nechet += 1
print(min(chet, nechet))


n = int(input())
a = list(map(int, input().split()))
count = 0
maxx = 999999999999999
k = max(a)
for i in a:
	for j in a:
		r = abs(i - j)
		if r % 2 == 1:
			count += 1
	if count < maxx:
		maxx = count
	count = 0
print(maxx)


t = int(input())
c = 0
for i in input().split():
	if int(i) % 2 == 0:
		c += 1
print(min(c, t - c))


from collections import defaultdict as df
from sys import stdin, stdout
import heapq
import bisect

def l():
	return list(map(int, stdin.readline().rstrip().split()))

def inti():
	return int(stdin.readline())
n = inti()
a = l()
ans = float('inf')
for i in range(n):
	count = 0
	for j in range(n):
		if abs(a[j] - a[i]) % 2 == 0:
			pass
		else:
			count += 1
	ans = min(ans, count)
print(ans)


n = int(input())
l = list(map(int, input().split()))
odd = 0
even = 0
for i in l:
	if i % 2:
		odd += 1
	else:
		even += 1
print(n - max(odd, even))


import sys
N = int(input())
PD = list(map(int, input().split()))
P = 0
D = 0
for x in PD:
	if x % 2 == 0:
		P = P + 1
	else:
		D = D + 1
print(min(P, D))


n = int(input())
xs = list(map(lambda t: int(t) % 2, input().split()))
a = sum(xs)
print(min(a, n - a))


def minCostToMoveChips(chips):
	even = 0
	odd = 0
	for i in chips:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	return min(even, odd)
n = int(input())
arr = input()
arr = [int(val) for val in arr.split()]
ans = minCostToMoveChips(arr)
print(ans)


from collections import deque
import sys

def inp():
	return sys.stdin.readline().strip()
n = int(inp())
a = list(map(int, inp().split()))
mx = float('inf')
for i in range(len(a)):
	ct = 0
	for j in range(len(a)):
		d = abs(a[i] - a[j])
		ct += d % 2
	mx = min(ct, mx)
print(mx)


n = int(input())
x = sum((int(v) % 2 for v in input().split()))
print(min(x, n - x))


n = int(input())
c = list(map(int, input().split()))
x = set(c)
coin = [0] * len(x)
j = -1
for xi in x:
	j += 1
	for i in c:
		if xi != i:
			coin[j] = coin[j] + abs(xi - i) % 2
print(min(coin))


gi = lambda : list(map(int, input().split()))
(n,) = gi()
l = [e % 2 for e in gi()]
print(min(sum(l), n - sum(l)))


n = int(input())
s = [int(i) for i in input().split()]
c = d = 0
for i in range(n):
	if s[i] % 2 == 0:
		c += 1
	else:
		d += 1
print(min(c, d))


n = int(input())
a = [int(x) for x in input().split()]
c = [0, 0]
for x in a:
	c[x % 2] += 1
print(min(c))


n = int(input())
arr = list(map(int, input().split()))
ans = 0
ec = 0
oc = 0
for i in range(n):
	if arr[i] % 2 == 0:
		ec += 1
	else:
		oc += 1
if ec > oc:
	print(oc)
else:
	print(ec)


n = int(input())
arr = list(map(int, input().split()))
ans = sum((i % 2 for i in arr))
print(min(ans, len(arr) - ans))


n = int(input())
s = list(map(int, input().split()))
ans = 10000000000000000000000000
for i in range(len(s)):
	x = 0
	for j in range(len(s)):
		if i != j:
			k = abs(s[i] - s[j])
			x += k % 2
	ans = min(ans, x)
print(ans)


class No:

	def __init__(self, posicao):
		self.posicao = int(posicao)
		self.lista = []
		self.distancias = []

	def add_no(self, no):
		self.lista.append(no)
		num = abs(self.posicao - no.posicao)
		self.distancias.append(num if num % 2 != 0 else 0)

def main():
	n = int(input())
	lista = list(map(No, input().split()))
	n = len(lista)
	for i in range(n):
		for j in range(n):
			if i != j:
				lista[i].add_no(lista[j])
	menor_valor = []
	for i in lista:
		try:
			menor = min(i.distancias)
		except:
			print(0)
			return
		menores = []
		for d in range(len(i.distancias)):
			if i.distancias[d] == menor:
				menores.append(d)
		menor_valor += [i.lista[j] for j in menores]
	dicionario = {}
	for i in menor_valor:
		try:
			dicionario[i] += 1
		except:
			dicionario[i] = 1
	menor_repeticao = max([dicionario[i] for i in dicionario])
	convergir = None
	for i in dicionario:
		if dicionario[i] == menor_repeticao:
			convergir = i
			break
	cont = 0
	if convergir is None:
		print(cont)
		return
	for i in lista:
		if i != convergir:
			dif = abs(i.posicao - convergir.posicao)
			if dif % 2 != 0:
				cont += dif % 2
	print(cont)
main()


n = int(input())
a = []
k = {}
for e in input().split(' '):
	j = int(e)
	a.append(int(e))
	if j in k.keys():
		k[int(e)] += 1
	else:
		k[j] = 1
l = []
f = -1
for i in k.keys():
	l.append(0)
	f += 1
	for j in k.keys():
		l[f] += abs(j - i) % 2 * k[j]
print(min(l))


n = int(input())
l1 = [int(x) % 2 for x in input().split()]
if 2 * sum(l1) > len(l1):
	print(len(l1) - sum(l1))
else:
	print(sum(l1))


def main():
	n = int(input())
	array = list(map(int, input().split()))
	count1 = 0
	count2 = 0
	for i in array:
		if i % 2 == 0:
			count1 += 1
		else:
			count2 += 1
	print(min(count1, count2))
main()


n = int(input())
numeros = list(map(int, input().split()))
impar = par = 0
for i in range(n):
	if numeros[i] % 2 == 0:
		par += 1
	else:
		impar += 1
print(min(impar, par))


n = int(input())
a = list(map(int, input().split()))
e = 0
o = 0
for x in a:
	if x % 2 == 0:
		e = e + 1
	else:
		o = o + 1
print(min(e, o))


def I():
	return int(input())

def IS():
	return input()

def IL():
	return list(map(int, input().split()))

def IM():
	return map(int, input().split())
n = I()
l = IL()
mini = 10 ** 100
for i in range(n):
	curr = l[i]
	cnt = 0
	for j in l:
		if j - curr & 1:
			cnt += 1
	mini = min(mini, cnt)
print(mini)


from sys import stdin
n = int(stdin.readline().rstrip())
k = [int(x) for x in stdin.readline().rstrip().split()]
(o, e) = (0, 0)
for i in k:
	if i & 1:
		o += 1
	else:
		e += 1
print(min(o, e))


count = input()
o = [*map(int, input().split())]
suma = 0
suma1 = 0
for i in o:
	if i % 2 == 0:
		suma += 1
	else:
		suma1 += 1
if suma < suma1:
	summa = suma
else:
	summa = suma1
print(summa)


n = int(input())
arr = [int(x) % 2 for x in input().split()]
print(min(arr.count(0), arr.count(1)))


n = int(input())
even = 0
odd = 0
s = input()
l = list(s.split())
for i in range(len(l)):
	if int(l[i]) % 2 == 0:
		even = even + 1
	else:
		odd = odd + 1
if even < odd:
	print(even)
else:
	print(odd)


n = int(input())
ar = list(map(int, input().rstrip().split()))
counter = []
start = 0
for i in range(n):
	start = ar[i]
	count = 0
	for j in range(n):
		trip = abs(ar[j] - start)
		if trip % 2 == 1:
			count += 1
	counter.append(count)
print(min(counter))


k = int(input())
a = list(map(int, input().split()))
c = 0
for i in a:
	c += i % 2
d = min(c, k - c)
print(d)


x = int(input())
y = input()
z = y.split()
w = [int(d) for d in z]
i = 0
j = 0
for num in w:
	if num % 2 == 0:
		i = i + 1
	if num % 2 == 1:
		j = j + 1
if i > j:
	print(j)
else:
	print(i)


n = int(input().strip())
points = list(map(int, input().strip().split()))
a = [points[0]]
for i in range(1, n):
	if abs(points[i] - points[0]) % 2 == 0:
		a.append(points[0])
	else:
		a.append(points[0] + 1)
b = [a.count(points[0]), a.count(points[0] + 1)]
print(min(b))


n = int(input())
chips = map(int, input().split())

def count(pred, xs):
	return len([x for x in xs if pred(x)])
n_even = count(lambda x: x % 2 == 0, chips)
n_odd = n - n_even
res = min(n_even, n_odd)
print(res)


n = int(input())
a = [int(i) for i in input().split()]
(even, odd) = (0, 0)
for i in a:
	if i % 2:
		odd += 1
	else:
		even += 1
if odd == 0 or even == 0:
	print(0)
else:
	print(min(odd, even))


N = int(input())
arr = list(map(int, input().split()))
num_odd = 0
num_even = 0
for a in arr:
	if a % 2 == 0:
		num_even += 1
	else:
		num_odd += 1
print(min(num_odd, num_even))


t = int(input())
a = list(map(int, input().split()))
li = []
for i in range(t):
	c = 0
	for j in range(t):
		if abs(a[i] - a[j]) % 2:
			c += 1
	li.append(c)
num = min(li)
print(num)


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L
c = cinn()
x = c.cin()
L = c.clist(x)
o = 0
e = 0
for el in L:
	if el % 2:
		o += 1
	else:
		e += 1
print(min(o, e))


def main():
	arr = [[], []]
	input()
	for i in input().split():
		i = int(i)
		if i % 2:
			arr[1].append(i)
		else:
			arr[0].append(i)
	if len(arr[0]) == max(len(arr[0]), len(arr[1])):
		return len(arr[1])
	return len(arr[0])
print(main())


size = int(input())
li = list(map(int, input().split()))
even = 0
for i in li:
	if i % 2 == 0:
		even += 1
print(min(even, len(li) - even))


n = int(input())
mas = input().split(' ')
chet = 0
for i in range(n):
	mas[i] = int(mas[i])
	if mas[i] % 2 == 0:
		chet += 1
print(min(chet, n - chet))


n = int(input())
data = [int(i) for i in input().split()]
k2 = 0
for elem in data:
	if elem % 2 == 0:
		k2 += 1
print(min(k2, n - k2))


n = int(input())
arr = input().split(' ')
evens = 0
for i in range(len(arr)):
	if int(arr[i]) % 2 == 0:
		evens += 1
odds = n - evens
if odds < evens:
	print(odds)
else:
	print(evens)


a = int(input())
b = list(map(int, input().split()))
(c, d) = (0, 0)
for x in b:
	if x % 2 == 0:
		c = c + 1
	else:
		d = d + 1
print(min(c, d))


import sys
i = n = 0
for line in sys.stdin:
	line = line.strip()
	if i == 0:
		n = int(line)
	else:
		arr = [int(num) for num in line.split()]
	i += 1
dp = [0] * n
for i in range(n):
	for j in range(n):
		dp[i] += abs(arr[i] - arr[j]) % 2
print(min(dp))


n = int(input())
l = list(map(int, input().split()))
(p, np) = (0, 0)
for i in l:
	if i % 2 == 0:
		p += 1
	else:
		np += 1
if p <= np:
	print(p)
else:
	print(np)


n = int(input())
nums = [int(i) for i in input().strip().split()]
odds = 0
evens = 0
for m in nums:
	if m % 2:
		odds += 1
	else:
		evens += 1
if odds == 0 or evens == 0:
	print(0)
else:
	print(min(odds, evens))


import sys
import math
while True:
	try:
		n = int(input())
	except EOFError:
		break
	ordinates = list(map(int, input().split()))
	mp = dict()
	for x in ordinates:
		if mp.get(x, 0) == 0:
			mp[x] = 0
		mp[x] += 1
	unique_ordinates = list(mp)
	res = None
	for key in unique_ordinates:
		current_value = 0
		for oKey in unique_ordinates:
			if oKey == key:
				continue
			diff = abs(key - oKey)
			diff %= 2
			current_value += diff * mp[oKey]
		if res is None:
			res = current_value
		elif current_value < res:
			res = current_value
	print(res)
pass


n = int(input())
x = list(map(int, input().split()))
c = 0
for i in x:
	c += i & 1
print(min(c, n - c))


n = int(input())
nums = input().split(' ')
c = 0
for i in range(len(nums)):
	if int(nums[i]) % 2 == 0:
		c = c + 1
if n - c > c:
	print(c)
else:
	print(n - c)


def find_no_of_odds_and_evens(list_of_numbers):
	number_of_odds = 0
	number_of_evens = 0
	for i in list_of_numbers:
		if i % 2 == 0:
			number_of_evens = number_of_evens + 1
		else:
			number_of_odds = number_of_odds + 1
	return (number_of_evens, number_of_odds)
number_of_numbers = int(input())
list_of_numbers = list(map(int, input().split(' ')))
(number_of_evens, number_of_odds) = find_no_of_odds_and_evens(list_of_numbers)
if number_of_evens > number_of_odds:
	print(number_of_odds)
else:
	print(number_of_evens)


n = int(input())
nbp = 0
npinp = 0
ch = input()
L = [int(i) for i in ch.split()]
for i in range(n):
	if L[i] % 2 == 0:
		nbp += 1
	else:
		npinp += 1
print(min(nbp, npinp))


n = int(input())
s1 = input()
(n1, n2) = (0, 0)
for data in s1.split():
	if int(data) % 2 == 0:
		n1 += 1
	else:
		n2 += 1
if n1 == 0 and n2 == 0:
	print(0)
elif n1 > n2:
	print(n2)
else:
	print(n1)


import collections
n = int(input())
l = [int(x) for x in input().split()]
c = collections.Counter(l)
(e, o) = (0, 0)
for i in c.keys():
	if i % 2 == 0:
		e = e + c[i]
	else:
		o = o + c[i]
print(min(o, e))


n = int(input())
a = map(int, input().split())
s = 0
for x in a:
	s += x % 2
print(min(s, n - s))


num = input()
chips = input().split(' ')
oddnum = 0
evennum = 0
for a in range(0, int(num)):
	if int(chips[a]) % 2 == 0:
		evennum = evennum + 1
	elif int(chips[a]) % 2 == 1:
		oddnum = oddnum + 1
print(min(evennum, oddnum))


n = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in range(len(lst)):
	if lst[i] % 2 == 0:
		cnt += 1
mn = cnt
cnt = 0
for i in range(len(lst)):
	if lst[i] % 2 == 1:
		cnt += 1
mn = min(cnt, mn)
print(mn)


n = int(input())
a = []
for i in input().split():
	num = int(i) % 2
	a.append(num)
t = min(a.count(0), a.count(1))
print(t)


a = int(input())
b = list(map(int, input().split()))
count = len(list(filter(lambda x: x % 2 != 0, b)))
print(min(count, a - count))


num = int(input())
chips = input().split()
even = 0
odd = 0
for i in range(num):
	x = int(chips[i])
	if x % 2 == 0:
		even += 1
	else:
		odd += 1
if even < odd:
	print(even)
else:
	print(odd)


n = int(input())
arr = list(map(int, input().split()))
count_odd = 0
count_eve = 0
for i in arr:
	if i % 2 == 0:
		count_eve += 1
	else:
		count_odd += 1
print(min(count_eve, count_odd))


n = int(input())
c = 0
for a in input().split():
	if int(a) & 1:
		c += 1
print(min(c, n - c))


n = int(input())
x = [int(i) % 2 for i in input().split()]
print(min(sum(x), len(x) - sum(x)))


n = int(input())
xs = [*map(int, input().split())]
ne_parnye = sum(map(lambda x: x % 2, xs))
parnye = n - ne_parnye
print(min(parnye, ne_parnye))


def mi():
	return list(map(int, input().split()))
n = int(input())
a = list(mi())
for i in range(n):
	a[i] = a[i] % 2
o = a.count(1)
z = n - o
print(min(o, z))


def solve(arr, n):
	return min(n - sum(list(map(lambda x: x % 2, arr))), sum(list(map(lambda x: x % 2, arr))))

def main():
	n = int(input())
	arr = list(map(int, input().strip().split()))
	print(solve(arr, n))
main()


n = int(input())
a = list(map(int, input().split()))
ans = 100
for i in a:
	s = 0
	for j in a:
		s += abs(i - j) % 2
	ans = min(ans, s)
print(ans)


t1 = 0
n = int(input(''))
for i in list(map(int, input().split())):
	if i & 1:
		t1 += 1
print(min(t1, n - t1))


N = int(input())
L = list(map(int, input().split()))
p = 0
d = 0
for x in L:
	if x % 2 == 0:
		p = p + 1
	else:
		d = d + 1
a = min(p, d)
print(a)


x = int(input())
l = list(map(int, input().split()))
d = 0
for i in l:
	if i % 2 == 0:
		d += 1
print(min(d, x - d))


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
msi = lambda : map(int, stdin.readline().split())
lsi = lambda : list(msi())
n = ii()
x = li()
(c1, c2) = (0, 0)
for e in x:
	if e % 2 == 1:
		c1 += 1
	else:
		c2 += 1
print(min(c1, c2))


import math

def take_list(n: int) -> list:
	_list = input().split()
	_list = [int(i) for i in _list]
	return _list

def evaluate_cost(fishki: list) -> int:
	primary_cost = math.inf
	for i in range(len(fishki)):
		current_cost = 0
		pos = fishki[i]
		for j in fishki:
			if (pos - j) % 2 == 1:
				current_cost += 1
		if current_cost < primary_cost:
			primary_cost = current_cost
	return primary_cost

def main():
	n = int(input())
	fishki = take_list(n)
	print(evaluate_cost(fishki))
main()


input()
a = [int(x) for x in input().split()]
chto = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		chto += 1
print(min(chto, len(a) - chto))


import sys
in_file = sys.stdin
n = int(in_file.readline().strip())
A = list(map(int, in_file.readline().strip().split()))
even = 0
odd = 0
for i in A:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
sys.stdout.write(str(min(odd, even)))
sys.stdout.flush()


n = int(input())
l = list(map(int, input().split()))
m = max(l)
c = 0
for i in l:
	d = (m - i) % 2
	c = c + d
g = n - c
if g < c:
	print(g)
else:
	print(c)


n = int(input())
fishki = list(map(int, input().split()))
result = [0, 0]
if n != 1:
	for i in range(n):
		if fishki[i] % 2 == 0:
			result[0] += 1
		else:
			result[1] += 1
	print(min(result))
else:
	print(0)


def getResult(a, n):
	evenCount = 0
	oddCount = 0
	for i in range(n):
		if a[i] & 1 == 0:
			oddCount += 1
		else:
			evenCount += 1
	if oddCount > evenCount:
		return evenCount
	return oddCount
n = int(input())
l = [int(x) for x in input().split()]
print(getResult(l, n))


number = int(input())
list_number = []
inp = input()
inp = inp.split(' ')
list_number = [int(x) for x in inp]
odd = even = 0
for i in range(number):
	if list_number[i] % 2 == 1:
		odd += 1
	else:
		even += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
lst = [int(i) for i in input().split()]
even = 0
for i in lst:
	if i % 2:
		even += 1
print(min(even, n - even))


n = int(input())
a = [int(i) for i in input().split()]
even = 0
odd = 0
for i in range(n):
	if a[i] % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
l = list(map(int, input().split()))[:n]
l.sort()
d = 0
c = 0
g = 0
for i in range(0, n):
	if l[i] % 2 == 0:
		c += 1
		e = l[i]
	else:
		d += 1
		f = l[i]
if c > d:
	for j in range(n):
		g += (l[j] - e) % 2
	print(g)
else:
	for j in range(n):
		g += (l[j] - f) % 2
	print(g)


def chip(x):
	a = 0
	b = 0
	for n in range(0, len(x)):
		if x[n] % 2 == 0:
			a += 1
		else:
			b += 1
	if a > b:
		print(b)
	else:
		print(a)
y = int(input())
x = list(map(int, input().split()))
chip(x)


a = int(input())
b = list(map(int, input().split()))
c1 = 0
c2 = 0
for x in b:
	if x % 2 == 0:
		c1 += 1
	else:
		c2 += 1
if c1 < c2:
	print(c1)
else:
	print(c2)


n = int(input())
num = input().split()
counterOdd = 0
for i in range(len(num)):
	counterOdd += 1 if int(num[i]) % 2 == 1 else 0
if counterOdd >= len(num) - counterOdd:
	print(len(num) - counterOdd)
else:
	print(counterOdd)


n = int(input())
l = [int(x) for x in input().split()]
o = 0
e = 0
for i in l:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
print(min(o, e))


n = int(input())
f = [int(x) for x in input().split(' ')]
count_even = 0
for i in f:
	if i % 2 == 0:
		count_even += 1
print(min(count_even, n - count_even))


num = int(input())
arr = list(map(int, input().split()))
o = 0
e = 0
for i in range(len(arr)):
	if arr[i] % 2 == 0:
		e += 1
	else:
		o += 1
if o > e:
	n_coin = e
else:
	n_coin = o
print(n_coin)


n = int(input())
a = list(map(int, input().strip().split(' ')))
c = 0
for i in a:
	if i % 2:
		c += 1
print(min(c, n - c))


S = int(input())
s = list(map(int, input().strip().split()))
p = 0
d = 0
for x in range(S):
	f = s[x]
	if f % 2 == 0:
		p = p + 1
	else:
		d = d + 1
if p < d:
	print(p)
else:
	print(d)


m = int(input())
l = list(map(int, input().split()))
k = list(set(l))
mi = 10 ** 9 + 1
for i in k:
	c = 0
	for j in l:
		c += abs(i - j) % 2
	mi = min(c, mi)
print(mi)


n = int(input())
l = list(map(int, input().rstrip().split()))
s = sum((i % 2 == 0 for i in l))
print(min(s, n - s))


(a, b) = (0, 0)
n = int(input())
x = map(int, input().split())
for i in x:
	if i % 2:
		a += 1
	else:
		b += 1
print(min(a, b))


from random import randint
n = int(input())
ch = 0
nech = 0
for i in map(int, input().split()):
	if i % 2 == 0:
		ch += 1
	else:
		nech += 1
if nech < ch:
	print(nech)
else:
	print(ch)


n = int(input())
a = list(map(int, input().split()))
chet = nech = 0
for i in range(n):
	if a[i] % 2 == 0:
		chet += 1
	else:
		nech += 1
print(min(chet, nech))


def init():
	n = int(input())
	nums = list(map(lambda x: int(x), input().split(' ')))
	odd = 0
	even = 0
	for i in range(n):
		if nums[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	if even >= odd:
		print(odd)
	else:
		print(even)
init()


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
n = ii()
d = li()
odd = 0
for i in d:
	if i % 2:
		odd += 1
print(min(odd, n - odd))


numbers = int(input())
string = input()
nums = [int(x) for x in string.split()]
e = o = 0
for i in range(len(nums)):
	if nums[i] % 2 == 0:
		e += 1
	else:
		o += 1
print(min(e, o))


n = int(input())
a = list(map(int, input().split()))
ans = 9999999999
for i in range(len(a)):
	an = 0
	for j in range(len(a)):
		if (a[i] - a[j]) % 2 == 1:
			an += 1
	ans = min(ans, an)
print(ans)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
it = lambda : tuple(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = il()
mn = 100000000000000
for i in range(n):
	c = 0
	for j in range(n):
		c += (l[j] - l[i]) % 2
	mn = min(mn, c)
print(mn)


import sys
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
odds = 0
evens = 0
for i in range(n):
	if arr[i] % 2 == 0:
		evens += 1
	else:
		odds += 1
res = 0
if evens >= odds:
	res += odds
else:
	res += evens
print(res)


t = int(input())
f = input().split()
i = int(0)
ch = int(0)
ne = int(0)
m = []
for i in range(0, t):
	m.append(int(f[i]))
for i in range(0, t):
	if m[i] % 2 == 0:
		ch += 1
	else:
		ne += 1
if ch >= ne:
	print(ne)
else:
	print(ch)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	even = 0
	odd = 0
	for i in arr:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(even, odd))
main()


import sys
n = int(input())
x = list(map(int, input().split()))
ans = 999999999999
for i in range(n):
	pivot = x[i]
	sum = 0
	for j in range(n):
		if i != j:
			diff = abs(x[i] - x[j])
			print('{} - {} = {}'.format(x[i], x[j], diff), file=sys.stderr)
			if diff & 1 != 0:
				sum += 1
	ans = min(ans, sum)
	print('sum = {}, ans = {}'.format(sum, ans), file=sys.stderr)
print(ans)


x = int(input())
y = input().split(' ')
even = 0
odd = 0
for i in range(x):
	z = int(y[i])
	if z % 2 == 0:
		even = even + 1
	else:
		odd = odd + 1
if odd < even:
	print(odd)
else:
	print(even)


n = int(input())
a = list(map(int, input().split()))
s = 0
s1 = 0
for i in range(n):
	if a[i] % 2 == 0:
		s += 1
	else:
		s1 += 1
print(min(s, s1))


n = int(input())
x = list(map(int, input().split()))
ans = float('inf')
for e in x:
	t = 0
	for f in x:
		if abs(e - f) == 2:
			pass
		else:
			t += abs(e - f) % 2
	ans = min(t, ans)
print(ans)


n = int(input())
A = [int(i) for i in input().split()]
e = 0
for i in range(n):
	if A[i] % 2 == 0:
		e += 1
print(min(e, n - e))


n = int(input(''))
xi = list(map(int, input().split(' ')))
e = 0
o = 0
for i in range(n):
	if xi[i] % 2 == 0:
		e = e + 1
	else:
		o = o + 1
if o > e:
	print(e)
elif e > o:
	print(o)
else:
	print(e)


import sys
import copy
sys.setrecursionlimit(1000000)
n = int(input())
x = [int(x) for x in input().split()]
(odd, even) = (0, 0)
for i in range(n):
	if x[i] % 2:
		odd += 1
	else:
		even += 1
print(min(odd, even))


n = int(input())
a = list(map(int, input().split()))
x = list(filter(lambda _: _ % 2, a))
print(min(len(x), len(a) - len(x)))


n = int(input())
li = list(map(int, input().split()))
l = []
x = 0
y = 0
for i in range(0, n):
	if li[i] % 2 == 0:
		x += 1
	else:
		y += 1
if y >= x:
	print(x)
else:
	print(y)


n = int(input())
arr = [int(x) for x in input().split()]
(odd, even) = (0, 0)
for x in arr:
	if x % 2:
		odd += 1
	else:
		even += 1
print(min(odd, even))


n = int(input())
arr = list(map(int, input().split()))
counto = 0
counte = 0
for i in range(n):
	if arr[i] % 2 == 0:
		counte += 1
	else:
		counto += 1
print(min(counto, counte))


n = int(input())
array = [int(_) for _ in input().split()]
(odd, even) = (0, 0)
for i in range(len(array)):
	if array[i] % 2 == 1:
		odd += 1
	else:
		even += 1
print(odd if odd < even else even)


T = int(input())
arr = list(map(int, input().split()))
o = 0
m = 0
for i in range(0, T):
	if arr[i] % 2 == 0:
		o += 1
	else:
		m += 1
print(min(o, m))


import operator
import collections
n = int(input())
cords = list(map(int, input().split()))
evens = 0
odds = 0
cne = 0
cno = 0
ste = 0
sto = 0
center = n // 2
for el in cords:
	if el % 2 == 0:
		evens += 1
		if abs(el - center) < abs(ste - center):
			ste = el
	else:
		odds += 1
		if abs(el - center) < abs(sto - center):
			sto = el
if evens > odds:
	print(odds)
else:
	print(evens)


n = int(input())
a = map(int, input().split())
even = 0
not_even = 0
money = 0
for i in a:
	if i % 2 == 0:
		even += 1
	else:
		not_even += 1
if even >= not_even:
	money += not_even
else:
	money += even
print(money)


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
	n = int(input())
	x = list(map(int, input().split()))
	(even, odd) = (0, 0)
	for i in range(n):
		if x[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(even, odd))
main()


import os
import sys
from io import BytesIO, IOBase

def solution(n, arr):
	odds = sum((1 for x in arr if x & 1 == 1))
	eves = n - odds
	write(min(odds, eves))

def main():
	n = r_int()
	arr = r_array()
	solution(n, arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


n = int(input())
s = input()
l = list(map(int, s.split()))
c = 0
for item in l:
	if item % 2 == 1:
		c += 1
print(min(c, n - c))


l = int(input())
n = list(map(int, input().split()))
count_even = 0
count_odd = 0
price = 0
for i in range(l):
	if n[i] % 2 == 0:
		count_even += 1
	else:
		count_odd += 1
if count_even < count_odd:
	price = count_even
	print(price)
else:
	price = count_odd
	print(price)


n = int(input())
X = list(map(int, input().split()))
e = 0
o = 0
for i in range(n):
	if X[i] % 2 == 0:
		e += 1
	else:
		o += 1
if o == 0 or e == 0:
	print(0)
else:
	print(min(o, e))


k = int(input())
temp = [int(i) for i in input().split()]
temp.sort()
a = 0
b = 0
if len(temp) == 1:
	print(0)
else:
	for i in temp:
		if i % 2 != 0:
			a = a + 1
		else:
			b = b + 1
	print(min(a, b))


def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	odd = len([x for x in arr if x % 2 == 1])
	even = n - odd
	print(min(odd, even))
solve()


n = int(input())
l = [int(x) for x in input().split()]
cnt = 0
for i in l:
	if i % 2 != 0:
		cnt += 1
print(min(cnt, n - cnt))


a = input().split()
n = int(a[0])
a = input().split()
ga = 0
gb = 0
for i in range(n):
	if int(a[i]) % 2 == 1:
		ga += 1
	else:
		gb += 1
if ga > gb:
	print(gb)
else:
	print(ga)


_ = input()
a = list(map(int, input().split()))
even_count = 0
for ai in a:
	if ai % 2 == 0:
		even_count += 1
print(min(even_count, len(a) - even_count))


n = int(input())
ln = list(map(int, input().split()))
even = [i for i in ln if i % 2 == 0]
odd = [i for i in ln if i % 2 == 1]
coins = 0
if len(even) > len(odd):
	for i in set(odd):
		coins += odd.count(i)
else:
	for i in set(even):
		coins += even.count(i)
print(coins)


n = int(input())
arr = list(map(int, input().strip().split()))
cost = 0
for i in range(1, n):
	if abs(arr[0] - arr[i]) % 2 != 0:
		cost += 1
cost = min(cost, n - cost)
print(cost)


a = int(input())
b = list(map(int, input().split()))
(co1, co2) = (0, 0)
for x in b:
	if x % 2:
		co1 += 1
	else:
		co2 += 1
if co1 > co2:
	print(co2)
else:
	print(co1)


n = int(input())

def intmaker(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
arr = intmaker(input().split())
odds = 0
for i in range(n):
	if arr[i] % 2 == 1:
		odds += 1
print(min(odds, n - odds))


import sys

def main():
	n = sys.stdin.readline()
	nums = [int(x) for x in sys.stdin.readline().split(' ')]
	odds = [x for x in nums if x % 2 != 0]
	return min(len(odds), len(nums) - len(odds))
print(main())


n = int(input())
A = [int(x) for x in input().split()]
odd = 0
even = 0
for i in A:
	if i & 1:
		odd += 1
	else:
		even += 1
print(min(odd, even))


import operator

def chipsMoving(n, coord):
	zero = 0
	one = 0
	for i in coord:
		if i % 2 == 0:
			one += 1
		else:
			zero += 1
	return min(one, zero)
n = int(input())
coord = list(map(int, input().split()))
print(chipsMoving(n, coord))


from math import *
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in a:
	if i % 2 == 0:
		cnt += 1
print(min(cnt, n - cnt))


S = int(input())
s = list(map(int, input().strip().split()))
pari = 0
dispari = 0
for n in range(S):
	b = s[n]
	if b % 2 == 0:
		pari += 1
	else:
		dispari += 1
if pari < dispari:
	print(pari)
else:
	print(dispari)


n = int(input())
ans = sum((1 for i in input().split() if int(i) % 2))
print(min(ans, n - ans))


n = int(input())
X = map(int, input().split())
num_even = sum([1 if x % 2 == 0 else 0 for x in X])
num_odd = n - num_even
print(min(num_odd, num_even))


a = int(input())
info = [int(a) for a in input().split()]
x = 0
for i in info:
	if i % 2:
		x += 1
print(min(x, a - x))


n = int(input())
x = [int(t) for t in input().split(' ')]
mcost = 1000000000
for s in range(n):
	xs = x[s]
	cost = 0
	for xi in x:
		cost += xi % 2 != xs % 2
	mcost = min(cost, mcost)
print(mcost)


n = int(input())
l = [int(x) for x in input().split()]
c = 0
for i in l:
	if i % 2 == 0:
		c += 1
if n - c > c:
	print(c)
else:
	print(n - c)


n = int(input())
l = list(map(int, input().split()))
m = 10000000
for i in range(n):
	c = 0
	for j in range(n):
		if abs(l[i] - l[j]) % 2 == 1:
			c = c + 1
	m = min(m, c)
print(m)


n = int(input())
array = [int(x) for x in input().split()]
evens = 0
odds = 0
for x in array:
	if x % 2 == 0:
		evens += 1
	else:
		odds += 1
if evens > odds:
	print(odds)
else:
	print(evens)


ar = []
size1 = int(input())
for t in input().split(' '):
	ar.append(int(t) % 2)
one = 0
zero = 0
for x in ar:
	if x == 1:
		one = one + 1
	else:
		zero = zero + 1
if one < zero:
	print(one)
else:
	print(zero)


n = int(input())
x = input()
L = x.split()
for i in range(0, n):
	L[i] = int(L[i])
c = 0
for j in L:
	if j % 2 == 0:
		c = c + 1
if c >= n / 2:
	print(n - c)
else:
	print(c)


n = int(input())
l = input()
numbers = list(map(int, l.split()))
even = 0
odd = 0
for num in numbers:
	if num % 2 == 0:
		even += 1
	else:
		odd += 1
leng = len(numbers)
if even == leng or odd == leng:
	cost = 0
else:
	cost = min(even, odd)
print(cost)


n = int(input())
l = [int(i) for i in input().split()]
odds = [i for i in l if i % 2 == 1]
evens = [i for i in l if i % 2 == 0]
if odds:
	odd = min(odds)
if evens:
	even = min(evens)
(c1, c2) = (0, 0)
for i in l:
	if odds:
		if abs(i - odd) % 2 != 0:
			c1 += 1
	if evens:
		if abs(i - even) % 2 != 0:
			c2 += 1
if not evens:
	print(c1)
elif not odds:
	print(c2)
else:
	print(min(c1, c2))


t = int(input())
arr = list(map(int, input().split()))
ed = 0
ds = 0
for i in range(0, t):
	if arr[i] % 2 != 0:
		ed += 1
	else:
		ds += 1
print(min(ed, ds))


n = int(input())
x = list(map(int, input().split()))
cnto = 0
for i in x:
	if i % 2 == 0:
		cnto += 1
print(min(cnto, n - cnto))


n = int(input())
aria = []
aria = list(map(int, input().split()))
ans = 1000000000
for i in range(0, n):
	cost = 0
	for j in range(0, n):
		cost += abs(aria[i] - aria[j]) % 2
	if cost < ans:
		ans = cost
print(ans)


N = int(input())
numbers = list(map(int, input().split(' ')))
even_numbers = []
odd_numbers = []
for n in numbers:
	if n % 2 == 0:
		even_numbers += [n]
	else:
		odd_numbers += [n]
print(min(len(even_numbers), len(odd_numbers)))


def main():
	n = int(input())
	xx = map(int, input().split())
	counts = [0, 0]
	for x in xx:
		counts[x % 2] += 1
	print(min(counts))
main()


input()
o = [0, 0]
for x in input().strip().split():
	o[int(x) % 2] += 1
print(min(o))


n = int(input())
x = list(map(int, input().split()))
a = b = 0
for j in x:
	if j % 2 == 0:
		a += 1
	elif j % 2 == 1:
		b += 1
print(min(a, b))


n = int(input())
chips = list(map(int, input().strip().split(' ')))
count_odd = sum(map(lambda x: x & 1, chips))
count_even = n - count_odd
print(min(count_odd, count_even))


import sys
import io
import os
total = 0
failed = 0

def run(test, res):
	x = io.StringIO()
	with io.StringIO(test) as sys.stdin:
		with x as sys.stdout:
			work()
			z = x.getvalue().strip()
	sys.stdout = sys.__stdout__
	print('Passed?', z == res)
	print('Expected: ', res)
	print('Actual  : ', z)
	global total, failed
	total += 1
	failed += 1 if z != res else 0

def work():
	a = input()
	z = list(map(int, input().split()))
	b = [0, 0]
	for x in z:
		b[x % 2] += 1
	print(min(b[0], b[1]))

def test():
	run('3\n1 2 3', '1')
	run('5\n2 2 2 3 3', '2')
if 'LOCALTEST' in os.environ:
	test()
	print('\n Result: %s (%d total, %d failed)' % ('FAILED' if failed > 0 else 'PASSED', total, failed))
else:
	work()


q = int(input())
w = list(map(int, input().split()))
k = 0
for i in w:
	if i % 2 == 0:
		k += 1
e = q - k
if max(e, k) == k:
	print(e)
else:
	print(k)


import sys
import random
input = sys.stdin.readline
n = int(input())
chips = list(map(int, input().split()))
impairs = sum([x & 1 for x in chips])
pairs = n - impairs
print(min(pairs, impairs))


n = int(input())
fish = list(map(lambda s: int(s) % 2, input().split()))
odd = fish.count(1)
print(min(odd, n - odd))


n = int(input())
arr = [int(s) for s in input().split()]
cnt = 0
for s in arr:
	if s % 2 == 0:
		cnt += 1
print(min(cnt, n - cnt))


n = int(input())
entrada = input()
vet = entrada.split(' ')
par = 0
impar = 0
i = 0
while i < n:
	if int(vet[i]) % 2 == 0:
		par += 1
	else:
		impar += 1
	i += 1
if par > impar:
	print(impar)
else:
	print(par)


n = int(input())
a = 0
b = 0
c = [int(i) for i in input().split()]
for i in range(n):
	if c[i] % 2 == 0:
		a += 1
	else:
		b += 1
print(min(a, b))


n = int(input())
a = list(map(int, input().split()))
co = sum((x % 2 for x in a))
ce = n - co
print(min(co, ce))


def main():
	n = int(input())
	vals = [int(v) for v in input().split()]
	odd_count = len([v for v in vals if v % 2 == 0])
	even_count = len([v for v in vals if v % 2 != 0])
	if odd_count > even_count:
		print(even_count)
	else:
		print(odd_count)
main()


n = int(input())
a = list(map(int, input().split()))
evens = len([x for x in a if x % 2 == 0])
odds = len([x for x in a if x % 2 == 1])
print(min(odds, evens))


n = input()
a = [int(i) for i in input().split()]
a.sort()
cash = 10 ** 7
for i in a:
	money = 0
	for j in a:
		if abs(i - j) % 2 != 0:
			money += 1
	if cash > money:
		cash = money
print(cash)


N = int(input())
x_list = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
	tmp = 0
	one = 0
	x = x_list[i]
	for j in range(N):
		y = x_list[j]
		if abs(x - y) % 2 == 1:
			one += 1
	ans = min(ans, one)
print(ans)


n = int(input())
chips = [int(x) for x in input().split()]
chips_dict = {}
for chip in chips:
	if chip not in chips_dict:
		chips_dict[chip] = 1
	else:
		chips_dict[chip] += 1
min_cost = -1
for current_chip in chips_dict:
	sum = 0
	for chip in chips_dict:
		sum += (chip - current_chip) % 2 * chips_dict[chip]
	if min_cost < 0:
		min_cost = sum
	elif sum < min_cost:
		min_cost = sum
print(min_cost)


import sys
import itertools
n = None
pos = []
for (c, line) in zip(itertools.count(), sys.stdin):
	if c == 0:
		n = int(line)
	if c == 1:
		pos = list(map(int, line.split(' ')))
		break
odd_count = 0
even_count = 0
for p in pos:
	if p % 2 == 0:
		even_count += 1
	else:
		odd_count += 1
print(min(even_count, odd_count))


n = int(input())
o = e = 0
for i in map(int, input().split()):
	if i % 2:
		o += 1
		continue
	e += 1
print(min(o, e))


input()
lst = list(map(int, input().split()))
cntr = 0
for i in lst:
	if i % 2 == 0:
		cntr += 1
print(min(cntr, len(lst) - cntr))


import math
n = int(input())
arr = [int(x) for x in input().split(' ')]
odd = 0
even = 0
for x in arr:
	if x % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


b = int(input())
a = list(map(int, input().split()))
e = 0
o = 0
for i in range(b):
	if a[i] % 2 == 0:
		e = e + 1
	else:
		o = o + 1
print(min(o, e))


n = int(input())
a = [int(o) for o in input().split()]
o = 0
e = 0
for i in a:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
print(min(e, o))


print((lambda n, k: min(n - k, k))(int(input()), sum(map(lambda s: int(s) % 2, input().split()))))


def f(l):
	no = sum([a % 2 == 1 for a in l])
	ne = sum([a % 2 == 0 for a in l])
	return min(no, ne)
n = input()
l = list(map(int, input().split()))
print(f(l))


no_of_chips = int(input())
coordinate = list(map(int, input().split()))
dict = {}
for i in range(len(coordinate)):
	dict[coordinate[i]] = coordinate.count(coordinate[i])
even = 0
odd = 0
for i in dict.keys():
	if i % 2 == 0:
		even += dict[i]
	else:
		odd += dict[i]
if even <= odd:
	print(even)
else:
	print(odd)


(n, even, odd) = (input(), 0, 0)
for val in input().split():
	if int(val) % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
nums = list(map(int, input().split()))
evs = len([i for i in nums if i % 2 == 0])
print(min(n - evs, evs))


import math
import sys
from collections import defaultdict
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	n = ri()
	a = rl()
	p = len([val for val in a if val % 2 == 0])
	n = len([val for val in a if val % 2 == 1])
	print(min(p, n))
main()


n = int(input())
a = list(map(int, input().split()))
m = 0
mm = 105
for i in range(n):
	for j in range(n):
		m += (a[i] - a[j]) % 2
	if m < mm:
		mm = m
	m = 0
print(mm)


entry = int(input())
numbers = list(map(int, input().split()))
even = 0
odd = 0
for num in numbers:
	if num % 2 == 0:
		even = even + 1
	else:
		odd = odd + 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
a = list(map(int, input().split()))
a.sort()
l = [0 for i in range(len(a))]
for i in range(len(a)):
	for j in range(len(a)):
		if i != j:
			l[i] += abs(a[i] - a[j]) % 2
print(min(l))


n = int(input())
l = list(map(int, input().split()))
e = 0
for i in range(n):
	if l[i] & 1 == 0:
		e += 1
print(min(e, n - e))


n = int(input())
a = [int(i) for i in input().split()]
e = 0
o = 0
for i in range(n):
	if a[i] % 2 == 0:
		e += 1
	else:
		o += 1
if o == 0 or e == 0:
	print(0)
elif o > e:
	print(e)
else:
	print(o)


a = int(input())
paros = 0
ptlan = 0
szam = [int(x) for x in input().split()]
for x in range(a):
	if szam[x] % 2 == 0:
		paros += 1
	else:
		ptlan += 1
if paros > ptlan:
	print(ptlan)
else:
	print(paros)


import sys
import os
from io import IOBase, BytesIO
import math
import collections
mod = 10 ** 9 + 7
pie = 3.1415926536

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def ain():
	return list(map(int, sin().split()))

def sin():
	return input().strip()

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def read2DIntArray(row, col):
	arr = []
	for i in range(0, row):
		temp = list(map(int, sin().split()))
		arr.append(temp)
	return arr

def read2DCharArray(row, col):
	arr = []
	for i in range(0, row):
		temp = str(sin())
		arr.append(temp)
	return arr

def smallestNumber(n):
	lst = list(str(n))
	lst.sort()
	tmp = ''
	for (i, n) in enumerate(lst):
		if n != '0':
			tmp = lst.pop(i)
			break
	return str(tmp) + ''.join(lst)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	lst = []
	for p in range(n + 1):
		if prime[p]:
			lst.append(p)
	return lst

def nCr(n, r):
	a = 1
	b = 1
	c = 1
	for i in range(1, n + 1):
		c *= i
	for i in range(1, r + 1):
		b *= i
	for i in range(1, n - r + 1):
		a *= i
	return c // (a * b)

def sieveOfEratosthenes1(N, s):
	prime = [False] * (N + 1)
	for i in range(2, N + 1, 2):
		s[i] = 2
	for i in range(3, N + 1, 2):
		if prime[i] == False:
			s[i] = i
			for j in range(i, int(N / i) + 1, 2):
				if prime[i * j] == False:
					prime[i * j] = True
					s[i * j] = i

def generatePrimeFactors(N):
	s = [0] * (N + 1)
	sieveOfEratosthenes1(N, s)
	curr = s[N]
	cnt = 1
	factors = []
	power = []
	while N > 1:
		N //= s[N]
		if curr == s[N]:
			cnt += 1
			continue
		factors.append(curr)
		power.append(cnt)
		curr = s[N]
		cnt = 1
	return (factors, power)

def main():
	n = int(sin())
	a = ain()
	e = 0
	for x in a:
		if x % 2 != 0:
			e += 1
	print(min(e, n - e))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
a = [int(i) for i in input().split()]
n1 = sum([1 for i in a if i % 2 == 0])
n2 = sum([1 for i in a if i % 2 == 1])
print(min(n1, n2))


from sys import stdin, stdout
n = int(stdin.readline())
x = list(map(int, stdin.readline().split()))
ans = n * 100
for X in x:
	xx = X - 10
	while xx <= X + 10:
		xx += 1
		cnt = 0
		for XX in x:
			if abs(xx - XX) % 2 == 1:
				cnt += 1
		ans = min(ans, int(cnt))
stdout.write('%d\n' % ans)


import math
tst = int(input())
a = map(int, input().split())
x = 0
y = 0
for c in a:
	if c % 2 == 0:
		x += 1
	else:
		y += 1
print(min(x, y))


n = int(input())
H = 11111111110
p = input().rstrip().split(' ')
for i in range(0, len(p)):
	A = int(p[i])
	T = 0
	for j in range(0, len(p)):
		if int(p[j]) == A:
			continue
		else:
			V = abs(int(p[j]) - A)
			T += V % 2
	H = min(T, H)
print(H)


n = int(input())
l = list(map(int, input().split()))
t1 = []
t2 = []
for i in range(len(l)):
	if l[i] % 2 == 1:
		t1.append(l[i])
	else:
		t2.append(l[i])
print(min(len(t1), len(t2)))


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
vals = RMI()
even_odd = [0, 0]
for i in vals:
	even_odd[i % 2] += 1
print(min(even_odd))


n = int(input())
l = list(map(int, input().split()))
f = 9000000000.0
for i in set(l):
	c = 0
	for j in l:
		c += (j - i) % 2
	f = min(c, f)
print(f)


from sys import stdin
import math
n = int(stdin.readline())
nums = list(map(int, stdin.readline().rstrip().split(' ')))
evens = sum((1 for num in nums if num % 2 == 0))
odds = len(nums) - evens
if evens == 0 or odds == 0:
	print(0)
else:
	print(min(evens, odds))


n = int(input())
list1 = sorted(list(map(int, input().split(' '))))
maxi = list1[-1]
ct = 0
for j in range(n - 1):
	if maxi - list1[j] & 1:
		ct += 1
print(min(ct, n - ct))


n = int(input())
li = list(map(int, input().split()))
odd_count = len(list(filter(lambda x: x % 2 != 0, li)))
even_count = len(li) - odd_count
if even_count < odd_count:
	print(even_count)
else:
	print(odd_count)


n = int(input())
l = list(map(int, input().split()))
l2 = [0, 0]
for x in l:
	if x % 2 == 0:
		l2[0] += 1
	else:
		l2[1] += 1
print(min(l2))


import sys
n = int(sys.stdin.readline())
arr = [int(x) for x in sys.stdin.readline().split()]
odd = 0
even = 0
for i in arr:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


nl = []
n = int(input())
a = list(map(int, input().split()))
for x in a:
	if x % 2 != 0:
		nl.append(x)
l = len(nl)
print(min(l, n - l))


import sys, os, re, datetime, copy
from collections import *
from bisect import *
from math import *

def mat(v, *dims):

	def dim(i):
		return [copy.copy(v) for _ in range(dims[-1])] if i == len(dims) - 1 else [dim(i + 1) for _ in range(dims[i])]
	return dim(0)
__cin__ = None

def cin():
	global __cin__
	if __cin__ is None:
		__cin__ = iter(input().split(' '))
	try:
		return next(__cin__)
	except StopIteration:
		__cin__ = iter(input().split(' '))
		return next(__cin__)

def iarr(T, n):
	return [T(cin()) for _ in range(n)]

def carr(n):
	return input()

def imat(T, n, m):
	return [iarr(T, m) for _ in range(n)]

def cmat(n, m):
	return [input() for _ in range(n)]
n = int(cin())
a = iarr(int, n)
ans = 1000000000000000
for (i, v) in enumerate(a):
	tot = 0
	for (j, p) in enumerate(a):
		d = abs(p - v) // 2
		r = abs(p - v) % 2
		tot += r
	ans = min(ans, tot)
print(ans)


i = int(input())
c = list(map(int, input().split()))
eve = 0
odd = 0
for j in c:
	if j % 2 == 0:
		eve += 1
	else:
		odd += 1
print(min(eve, odd))


(_, xs) = (input(), input())
x = [int(i) for i in xs.split()]
c_odd = c_nodd = 0
for i in x:
	if i % 2 == 0:
		c_odd += 1
	else:
		c_nodd += 1
print(min(c_odd, c_nodd))


from sys import stdin
inp = stdin.readline
t = int(inp().strip())
a = [int(x) for x in inp().split()]
odd = 0
even = 0
for i in a:
	if i % 2:
		odd += 1
print(min(odd, t - odd))


n = int(input())
x = list(map(int, input().split()))
y = sum((i % 2 for i in x))
ans = min(y, n - y)
print(ans)


input()
X = list(map(int, input().split()))
Odd = list(filter(lambda x: x % 2 == 0, X))
Even = list(filter(lambda x: x % 2 == 1, X))
print(min(len(Odd), len(Even)))


n = int(input())
l1 = list(map(int, input().split()))
x = 0
for item in l1:
	if item % 2 == 0:
		x += 1
print(min(x, n - x))


n = int(input())
arr = list(map(int, input().split()))
odd_pos = 0
for ele in arr:
	odd_pos += ele & 1
print(min(odd_pos, n - odd_pos))


n = int(input())
ans = sum((int(xi) % 2 for xi in input().split()))
print(min(ans, n - ans))


N = int(input())
bag = list(map(int, input().strip().split()))
pari = 0
dispari = 0
for n in range(N):
	v = bag[n]
	if v % 2 == 0:
		pari += 1
	else:
		dispari += 1
if pari < dispari:
	print(pari)
else:
	print(dispari)


v = int(input())
n = list(map(int, input().split()))
ch = 0
ne = 0
for i in range(len(n)):
	if n[i] % 2 != 0:
		ch += 1
	else:
		ne += 1
print(min(ch, ne))


n = int(input())
aray = list(map(int, input().split()))
no = -1
noo = -2
count = 0
countt = 0
for it in aray:
	jam = no - it
	if jam % 2 == 0:
		pass
	else:
		count += 1
for it in aray:
	jam = noo - it
	if jam % 2 == 0:
		pass
	else:
		countt += 1
print(min(count, countt))


n = int(input())
l = list(map(int, input().split()))
(cnteven, cntodd) = (0, 0)
for i in l:
	if i % 2 == 0:
		cnteven += 1
	else:
		cntodd += 1
print(min(cnteven, cntodd))


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def solve(A):
	(even, odd) = (0, 0)
	for x in A:
		if x & 1:
			odd += 1
		else:
			even += 1
	return min(even, odd)

def main():
	n = int(r())
	A = r_a(int)
	print(solve(A))
main()


a = int(input())
b = list(map(int, input().split()))
c = 0
for item in b:
	if item % 2 == 0:
		c += 1
print(str(min(c, a - c)))


import collections, heapq, bisect, math

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def calc(x, target):
	return int(target - x) % 2

def solve(A):
	out = float('Inf')
	average = sum(A) // len(A)
	for target in range(average - 5000, average + 5000):
		out = min(out, sum((calc(x, target) for x in A)))
	return out
q = 1
tests = []
for test in range(int(q)):
	n = input()
	tests.append([int(p) for p in input().split(' ')])
for test in tests:
	print(solve(test))


n = int(input())
l = list(map(int, input().strip().split()))
even = 0
odd = 0
for i in range(n):
	if l[i] % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
coordinates = list(map(int, input().strip().split()))
(odd, even) = (0, 0)
for i in range(n):
	odd += coordinates[i] % 2
	even += (coordinates[i] + 1) % 2
print(min(odd, even))


n = int(input())
chips = list(map(int, input().split(' ')))
minimum = float('infinity')
for i in range(len(chips)):
	total = 0
	for j in range(0, len(chips)):
		if i != j and int(abs(chips[i] - chips[j])) % 2 != 0:
			total += 1
	if total < minimum:
		minimum = total
print(minimum)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res) % MOD

def comb(n, x):
	(a, b) = (1, 1)
	for i in range(1, x + 1):
		a *= n + 1 - i
		b *= i
	return a // b % MOD

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
small = 'abcdefghijklmnopqrstuvwxyz'
large = small.upper()
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def interact(x, y):
	print('?', x + 1, y + 1)
	space = input()
	sys.stdout.flush()
	return int(input())

def solve():
	n = scanner()
	a = get_list()
	(even, odd) = (0, 0)
	for x in a:
		even += x % 2
		odd += x % 2 ^ 1
	print(min(even, odd))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = 1
for i in range(t):
	solve()


n = int(input())
x = list(map(int, input().split()))
(odd, even) = (0, 0)
for num in x:
	if num % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
(*arr,) = map(int, input().split())
cnto = 0
for i in arr:
	cnto += i & 1
print(min(cnto, n - cnto))


def solve(n, ar):
	even = 0
	odd = 0
	for i in range(n):
		if ar[i] % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(even, odd))
n = int(input())
ar = list(map(int, input().split()))
solve(n, ar)


n = int(input().strip())
points = list(map(int, input().strip().split()))
even = 0
for i in points:
	if i % 2 == 0:
		even += 1
answer = min(even, len(points) - even)
print(answer)


n = int(input())
l = list(map(int, input().split()))
m = [int(x) % 2 for x in l]
print(min(m.count(0), m.count(1)))


def cl(arr):
	q = 0
	o = 0
	for i in arr:
		if int(i) % 2 == 0:
			o = o + 1
		else:
			q = q + 1
	return min(q, o)
b = input()
a = input()
a = a.split(' ')
print(cl(a))


N = int(input())
riga = list(map(int, input().strip().split()))
pari = 0
dispari = 0
for n in range(N):
	a = riga[n]
	if a % 2 == 0:
		pari += 1
	else:
		dispari += 1
if pari < dispari:
	print(pari)
else:
	print(dispari)


while True:
	try:
		n = int(input())
		N = list(map(int, input().split()))
		d = [[0] * n for i in range(n)]
		for i in range(n):
			for j in range(n):
				d[i][j] = abs(N[i] - N[j]) % 2
		Sum = []
		for i in range(n):
			Sum.append(sum(d[i]))
		print(min(Sum))
	except:
		break


n = int(input())
(e, o) = (0, 0)
l = list(map(int, input().split()))
ln = len(l)
for i in l:
	if i % 2 == 0:
		o += 1
	else:
		e += 1
if o == 0 or e == 0:
	print(0)
elif o > e:
	print(e)
elif e > o:
	print(o)
else:
	print(ln // 2)


import math
import sys
from heapq import heappop
from heapq import heappush
from heapq import heapify
from bisect import insort
from sys import stdin, stdout
from collections import defaultdict
inp = lambda : int(stdin.readline())
sip = lambda : input()
mulip = lambda : map(int, input().split())
lst = lambda : list(map(int, stdin.readline().split()))
slst = lambda : list(sip())
arr2d = lambda x: [[int(j) for j in input().split()] for i in range(x)]
odds = lambda l: len(list(filter(lambda x: x % 2 != 0, l)))
evens = lambda l: len(list(filter(lambda x: x % 2 == 0, l)))
mod = pow(10, 9) + 7
n = inp()
A = lst()
o = odds(A)
e = evens(A)
print(min(o, e))


i = input()
nums = input().split(' ')
even = 0
odd = 0
for num in nums:
	if int(num) % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(str(odd))
else:
	print(str(even))


d = int(input())
s = list(map(int, input().split()))
countodd = 0
counteven = 0
for i in range(d):
	if s[i] % 2 == 0:
		counteven = counteven + 1
	else:
		countodd = countodd + 1
if countodd > counteven:
	print(counteven)
else:
	print(countodd)


n = int(input())
a = list(map(int, input().split()))
gan = gen = 0
for i in a:
	if i % 2:
		gan += 1
	else:
		gen += 1
print(min(gan, gen))


def solve(n, l):
	cnt = 0
	for item in l:
		cnt += item % 2 == 0
	return min(cnt, n - cnt)
n = int(input())
l = [int(i) for i in input().split()]
print(solve(n, l))


n = int(input())
k1 = 0
k2 = 0
b = input().split()
for i in range(n):
	if int(b[i]) & 1 == 1:
		k1 += 1
	else:
		k2 += 1
print(min(k1, k2))


n = int(input())
ganjil = 0
genap = 0
z = list(map(int, input().split()))
for j in z:
	if j % 2 == 0:
		genap += 1
	else:
		ganjil += 1
print(min(ganjil, genap))


n = int(input())
a = sum([int(x) % 2 for x in input().split()])
print(min(a, n - a))


t = int(input())
l = [int(x) for x in input().split()]
q = []
count = 0
for i in range(len(l)):
	count = 0
	for j in range(len(l)):
		x = len(l) - 1 - i
		if j != x:
			m = l[j] - l[x]
			if m & 1 != 0:
				count += 1
	q.append(count)
q.append(count)
print(min(q))


a = int(input())
b = [int(i) for i in input().split()]
even = 0
odd = 0
for i in b:
	if i == 0:
		even += 1
	elif i % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
a = list(map(int, input().split()))
ans_1 = 0
ans_2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		ans_1 += 1
	else:
		ans_2 += 1
print(min(ans_1, ans_2))


n = int(input())
arr = list(map(int, input().split()))
odd_num = 0
even_num = 0
for i in range(len(arr)):
	if arr[i] % 2 == 1:
		odd_num += 1
	else:
		even_num += 1
print(min(odd_num, even_num))


n = int(input())
x = [int(x) for x in input().split()]
x.sort()
odd = 0
even = 0
for i in range(n):
	if x[i] & 1 == 0:
		odd += 1
	else:
		even += 1
if odd >= even:
	print(even)
else:
	print(odd)


import math

def sol():
	n = int(input())
	A = [int(i) for i in input().split()]
	e = 0
	for i in A:
		if i % 2 == 0:
			e += 1
	o = n - e
	print(e if e <= o else o)
sol()


import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
odd = 0
even = 0
for i in range(n):
	if A[i] % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


n = int(input())
a = [int(x) for x in input().split()]
mini = 999999999
for i in range(n):
	d = 0
	for j in range(n):
		if j != i:
			if abs(a[j] - a[i]) % 2 != 0:
				d += 1
	if d < mini:
		mini = d
print(mini)


n = int(input())
x = list(map(int, input().split()))
y = list(filter(lambda x: x % 2 != 0, x))
print(min(len(y), n - len(y)))


import sys, math
input = sys.stdin.readline

def getInt():
	return int(input())

def getVars():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def getStr():
	return input().strip()
n = getInt()
a = getList()
(c0, c1) = (0, 0)
for i in range(n):
	if a[i] % 2 == 0:
		c0 += 1
	else:
		c1 += 1
print(min(c1, c0))


n = int(input())
arr = list(map(int, input().split()))
(chet, nechet) = (0, 0)
for i in range(len(arr)):
	if arr[i] % 2 == 0:
		chet += 1
	else:
		nechet += 1
print(min(chet, nechet))


a = input()
nums = input().split(' ')
odds = len([1 for i in nums if int(i) % 2 == 1])
evens = len([1 for i in nums if int(i) % 2 == 0])
print(min(odds, evens))


def move(A):
	n = len(A)
	dp = [[0] * n] * n
	mi = 25369858
	for i in range(n):
		s = 0
		for j in range(n):
			s += abs(abs(A[i] - A[j]) % 2)
		if mi > s:
			mi = s
	return mi
n = int(input())
A = list(map(int, input().strip().split()))
print(move(A))


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	n = sint()
	ara = sara()
	(odd, even) = (0, 0)
	for i in ara:
		if i % 2:
			odd += 1
		else:
			even += 1
	print(min(odd, even))
main()


def chip(a, n):
	(c, p) = (0, 0)
	for i in range(n):
		if a[i] % 2 == 0:
			c += 1
		else:
			p += 1
	if c > p:
		return p
	return c
n = int(input())
a = [int(x) for x in input().split()]
print(chip(a, n))


chip = int(input())
odd = 0
even = 0
li = list(map(int, input().split()))
for i in range(chip):
	if li[i] % 2 == 1:
		odd += 1
	else:
		even += 1
if odd > even:
	print(even)
else:
	print(odd)


n = int(input())
l = input().split(' ')
pairs = 0
odds = 0
for i in range(n):
	l[i] = int(l[i])
	if l[i] % 2 is 0:
		pairs += 1
	else:
		odds += 1
if pairs < odds:
	print(pairs)
else:
	print(odds)


n = int(input())
lst = [int(i) for i in input().split()]
(count1, count2) = (0, 0)
for elem in lst:
	if elem % 2:
		count1 += 1
	else:
		count2 += 1
print(min(count1, count2))


n = int(input())
a = list(map(int, input().split()))
o = 0
e = 0
i = 0
while i < n:
	if a[i] % 2 == 0:
		e += 1
	else:
		o += 1
	i += 1
print(min(e, o))


n = int(input())
l = list(map(int, input().split()))
s = 0
for i in range(n):
	s = s + l[i] % 2
print(min(s, n - s))


n = int(input())
a = list(map(int, input().split()))
d = dict()
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
b = []
for i in d.keys():
	b.append(i)
coins = []
for i in b:
	c = 0
	for j in range(n):
		inipos = a[j]
		finalpos = i
		diff = abs(finalpos - inipos)
		c += diff % 2
	coins.append(c)
print(min(coins))


from math import *
from sys import *
from collections import defaultdict
M = 10 ** 9 + 7

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a
		b >>= 1
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def factor(n):
	potentional_p = 3
	itog_list = {}
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			if n in itog_list:
				itog_list[n] += 1
			else:
				itog_list[n] = 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			if potentional_p in itog_list:
				itog_list[potentional_p] += 1
			else:
				itog_list[potentional_p] = 1
		potentional_p += 2
	return itog_list
t = 1
for _ in range(t):
	n = int(input())
	a = list(map(int, stdin.readline().split()))
	val1 = int(sum(a) // n)
	val2 = val1 + 1
	res1 = 0
	res2 = 0
	for x in a:
		if abs(x - val1) % 2 == 1:
			res1 += 1
		if abs(x - val2) % 2 == 1:
			res2 += 1
	print(min(res1, res2))


q = int(input())
numbers = map(int, input().split())
o = 0
for n in numbers:
	if n % 2 == 1:
		o += 1
e = q - o
print(min(e, o))


n = int(input())
l = [int(x) for x in input().split(' ')]
ans = 1000000
for i in range(n):
	amount = 0
	for j in range(n):
		if i == j:
			continue
		if abs(l[j] - l[i]) % 2:
			amount += 1
	ans = min([amount, ans])
print(ans)


def main():
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = float('inf')
	for i in range(n):
		k = 0
		for j in range(n):
			k += abs(a[j] - a[i]) % 2
		ans = min(ans, k)
	print(ans)
	return
main()


n = int(input())
l = list(map(int, input().split()))
m = 100000000000000000
for i in range(n):
	c = 0
	for j in range(n):
		if i != j:
			d = abs(l[i] - l[j])
			if d % 2 == 1:
				c += 1
	if c < m:
		m = c
print(m)


n = int(input())
f = [int(x) for x in input().split()]
f.sort()
answer = pow(10, 10)
for target in f:
	temp = 0
	for i in f:
		temp += abs(target - i) % 2
	answer = min(answer, temp)
print(answer)


def main():
	n = int(input())
	l = list(map(int, input().split(' ')))
	odd = sum([i % 2 for i in l])
	print(min(odd, n - odd))
main()


n = int(input().strip())
array = list(map(int, input().strip().split()))
odd = even = 0
for i in range(n):
	if array[i] & 1 != 0:
		odd += 1
	else:
		even += 1
res = min(odd, even)
print(res)


N = int(input())
A = map(int, input().split())
even = sum((1 if x % 2 == 0 else 0 for x in A))
print(min(even, N - even))


try:
	n = int(input())
	x = list(map(int, input().split()))
	z = 0
	l = []
	for i in range(n):
		for j in range(n):
			if i == j:
				continue
			elif abs(x[i] - x[j]) % 2 == 1:
				z += 1
		l.append(z)
		z = 0
	l.sort()
	print(l[0])
except:
	pass


n = int(input())
l = list(map(int, input().split()))
ev = 0
od = 0
for x in l:
	if x % 2 == 0:
		ev += 1
	else:
		od += 1
if ev == 0 or od == 0:
	print(0)
elif od > ev:
	print(ev)
else:
	print(od)


print([min(sum(a), n - sum(a)) for (n, a) in [[int(input()), [int(q) % 2 for q in input().split()]]]][0])


n = int(input())
l = [int(s) for s in input().split()]
odd = 0
for i in l:
	if i % 2 == 1:
		odd += 1
even = n - odd
print(min(odd, even))


size = int(input())
nums = list(map(int, input().split(' ')))
c = 0
for i in range(len(nums)):
	if nums[i] % 2 != 0:
		c += 1
print(min(c, size - c))


n = int(input())
s = str(input()).split()
m1 = 0
m0 = 0
for i in range(n):
	s[i] = int(s[i])
	if s[i] % 2 == 0:
		m1 += 1
	else:
		m0 += 1
if m0 < m1:
	print(m0)
else:
	print(m1)


n = int(input())
xs = [int(elem) for elem in input().split()]
even = 0
odd = 0
for i in range(n):
	if xs[i] % 2 == 1:
		odd += 1
	else:
		even += 1
ans = min(even, odd)
print(ans)


n = int(input())
a = list(map(int, input().split()))
s = len(list(filter(lambda x: x % 2 == 0, a)))
print(min(s, n - s))


n = int(input())
x = input().split()
even = []
odd = []
for i in range(n):
	x[i] = int(x[i])
	if x[i] % 2 == 0:
		even.append(x[i])
	else:
		odd.append(x[i])
if len(even) >= len(odd):
	ans = len(odd)
else:
	ans = len(even)
print(ans)


n = int(input())
s = [int(e) for e in input().split()]
e = 0
for x in s:
	if x % 2 == 0:
		e += 1
o = n - e
print(min(o, e))


n = int(input())
x = map(int, input().split())
x = list(map(lambda x: x % 2, x))
print(min(x.count(0), x.count(1)))


x = []
y = []
z = []
n = int(input())
x = [int(i) for i in input().split()]
for i in x:
	if i % 2 == 0:
		y.append(i)
	elif i % 2 == 1:
		z.append(i)
if len(y) > len(z):
	print(len(z))
else:
	print(len(y))


n = int(input())
x = list(map(int, input().split()))
even = 0
odd = 0
for i in x:
	if i & 1:
		odd += 1
	else:
		even += 1
if odd > even:
	print(even)
else:
	print(odd)


n = int(input())
arr = list(map(int, input().split()))
(evens, odds) = (0, 0)
for i in arr:
	if i % 2 == 0:
		evens += 1
	else:
		odds += 1
print(min(evens, odds))


def listsub(arr1, test, n):
	out = []
	for i in range(n):
		out.append(abs(test[i] - arr1[i]) % 2)
	return out
n = int(input())
(*arr,) = map(int, input().split())
setarr = list(set(arr))
cases = []
for elem in setarr:
	cases.append((elem,) * n)
cot = []
for case in cases:
	ans = listsub(case, arr, n)
	cot.append(ans.count(1))
print(min(cot))


k = int(input())
l = [int(x) for x in input().split(' ')]
s = 0
t = 0
for i in range(len(l)):
	if l[i] % 2 == 0:
		s = s + 1
	else:
		t = t + 1
print(min(s, t))


a = int(input())
b = list(map(int, input().split()))
c = b
tsum = 0
eve = 0
odd = 0
for x in b:
	if not x % 2:
		eve += 1
	else:
		odd += 1
print(min(odd, eve))


n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(0, n):
	if a[i] % 2 == 0:
		c = c + 1
if n - c < c:
	c = n - c
print(c)


t = int(input())
l = list(map(int, input().split()))
e = 0
o = 0
for i in range(len(l)):
	if l[i] % 2 == 0:
		e = e + 1
	else:
		o = o + 1
print(min(e, o))


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
sol = 0
ne = 0
no = 0
for i in range(0, n):
	if arr[i] % 2 == 0:
		ne += 1
	else:
		no += 1
print(min(ne, no))


N = int(input())
A = list(map(int, input().split()))
ev = 0
od = 0
for i in range(N):
	if A[i] % 2 == 0:
		ev += 1
	else:
		od += 1
if ev > od:
	print(od)
else:
	print(ev)


n = int(input())
a = list(map(int, input().split()))
c = 0
for i in a:
	c += i % 2
r = min(c, n - c)
print(r)


n = int(input())
n_even = 0
n_odd = 0
for c in input().split():
	if int(c) % 2 == 0:
		n_even += 1
	else:
		n_odd += 1
print(min(n_even, n_odd))


n = int(input())
li = list(map(int, input().split()))
ev = 0
odd = 0
for i in li:
	if i % 2 == 0:
		ev += 1
	else:
		odd += 1
print(min(odd, ev))


n = int(input())
A = list(map(int, input().split()))
O = 0
E = 0
for i in A:
	if i % 2 == 0:
		E = E + 1
	else:
		O = O + 1
print(min(O, E))


n = int(input())
x = list(map(lambda x: int(x) % 2, input().split()))
l = len(x)
odd = x.count(1)
print(min(odd, l - odd))


def max_c(arr):
	c = 0
	for i in arr:
		if arr.count(i) > c:
			c = arr.count(i)
			num = i
	return num
n = int(input())
arr = list(map(int, input().split()))
s = 0
x = max_c(arr)
for i in range(n):
	if abs(x - arr[i]) % 2 != 0:
		s = s + 1
if s > n // 2:
	print(n - s)
else:
	print(s)


numChips = int(input())
chips = [int(x) for x in input().split(' ')]
even = 0
odd = 0
for x in chips:
	if x % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
a = [int(x) for x in input().split()]
c1 = 0
c2 = 0
a = sorted(a)
r1 = a[-1]
for i in range(n):
	if (r1 - a[i]) % 2 == 1:
		c2 += 1
	else:
		c1 += 1
print(min(c1, c2))


n = int(input())
arr = list(map(int, input().split()))
(l, r) = (0, 0)
for i in arr:
	if i % 2 == 0:
		l += 1
	else:
		r += 1
print(min(l, r))


N = int(input())
l = [int(x) for x in input().split()]
ans = 0
for i in range(N):
	if l[i] % 2 != 0:
		ans += 1
print(min(ans, N - ans))


a = int(input())
b = list(map(int, input().split()))
d = list(filter(lambda x: x % 2 == 0, b))
e = list(filter(lambda x: x % 2 != 0, b))
if len(d) == len(b):
	print(0)
elif len(e) == len(b):
	print(0)
elif len(e) > len(d):
	print(len(d))
else:
	print(len(e))


n = int(input())
x = list(map(int, input().split()))
ne = no = 0
for i in x:
	if i % 2 == 0:
		ne += 1
	else:
		no += 1
print(min(no, ne))


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = [0] * 2
	for a in A:
		B[a % 2] += 1
	print(min(B))
main()


n = int(input())
l1 = [int(_) for _ in input().split()]
even = []
odd = []
l1_set = list(set(l1))
for i in l1_set:
	if i % 2 == 0:
		even.append(l1.count(i))
	else:
		odd.append(l1.count(i))
print(min(sum(even), sum(odd)))


import sys
n = int(input())
l = list(map(int, input().split()))
minimum = sys.maxsize
for i in range(n):
	total = 0
	for j in range(n):
		total += (l[i] - l[j]) % 2
	minimum = min(minimum, total)
print(minimum)


n = int(input())
s = input()
tokens = s.split(' ')
count_even = 0
count_odd = 0
for token in tokens:
	x = int(token)
	if x % 2 == 0:
		count_even += 1
	else:
		count_odd += 1
cost = min(count_odd, count_even)
print(cost)


ll = lambda : list(map(int, input().split()))
testcases = 1
for _ in range(testcases):
	[n] = ll()
	a = ll()
	(c1, c2) = (0, 0)
	for i in range(n):
		if a[i] & 1:
			c1 += 1
		else:
			c2 += 1
	print(min(n - c1, n - c2))


n = int(input())
a = list(map(int, input().split()))
a = sorted(a)
mid = a[n // 2]
count_odd = 0
coin_spent = 0
for i in range(n):
	if abs(a[i]) % 2 != 0:
		count_odd += 1
count_even = n - count_odd
print(min(count_even, count_odd))


def main():
	input()
	a = list(map(int, input().split()))
	b = [0, 0]
	for aa in a:
		b[aa % 2] += 1
	print(min(b))
main()


import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
odd = 0
even = 0
for x in l:
	if x % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		c = [0] * 2
		for b in a:
			c[b % 2] += 1
		rr.append(min(c))
	return JA(rr, '\n')
print(main())


n = int(input())
l = list(map(int, input().split()))
j = k = 0
for i in l:
	if i % 2 == 1:
		j += 1
	else:
		k += 1
print(min(j, k))


n = int(input())
cords = [int(x) for x in input().split()]
cords = cords
coins = 0
for cord in cords:
	coins += cord & 1
print(min(coins, n - coins))


n = input()
n = int(n)
i = 0
js = 0
os = 0
l = map(lambda x: int(x), input().split())
for i in l:
	if i % 2 == 0:
		os += 1
	else:
		js += 1
if os > js:
	print(js)
else:
	print(os)


n = int(input())
L = [int(i) for i in input().split()]
Ln = []
L.sort()
for i in range(0, n):
	coins = 0
	for j in range(0, n):
		if abs(L[i] - L[j]) % 2 != 0:
			coins += 1
	Ln.append(coins)
print(min(Ln))


n = int(input())
chip_list = list(map(int, input().split()))
ecount = 0
ocount = 0
for i in range(n):
	if chip_list[i] % 2 == 0:
		ecount += 1
	else:
		ocount += 1
if ecount >= ocount:
	print(ocount)
else:
	print(ecount)


n = int(input())
l = [int(x) for x in input().split()]
impar = 0
par = 0
for i in l:
	if i % 2:
		impar += 1
	else:
		par += 1
if impar > par:
	print(par)
else:
	print(impar)


a = int(input())
b = list(map(int, input().split()))
x = 0
y = 0
for i in range(a):
	if b[i] % 2 == 0:
		x += 1
	else:
		y += 1
print(min(x, y))


n = int(input())
x = list(map(int, input().split()))
cnt1 = cnt2 = 0
for x_i in x:
	if x_i % 2 == 0:
		cnt1 += 1
	else:
		cnt2 += 1
print(min(cnt1, cnt2))


I0 = lambda : map(int, input().split())
I1 = lambda : int(input())
I2 = lambda : list(map(int, input().split()))
n = I1()
a = I2()
z = f = 0
for i in range(n):
	if a[i] % 2 != 0:
		f += 1
	else:
		z += 1
print(min(z, f))


n = int(input())
c = [int(x) for x in input().strip().split()]
m = n + 2
for i in range(n):
	s = 0
	for j in range(n):
		if abs(c[i] - c[j]) % 2 is not 0:
			s += 1
	m = min(m, s)
print(m)


c = lambda d: [0, 1][int(d) % 2]
a = int(input())
b = list(map(c, input().split()))
print(b.count(1 if b.count(0) > b.count(1) else 0))


n = int(input())
m = sum((int(i) % 2 for i in input().split()))
print(min(m, n - m))


n = int(input())
f = input().split()
if n == 1:
	print('0')
else:
	f_half = len(f) / 2
	f = map(int, f)
	even = sum((1 for i in f if i % 2 == 0))
	if even < f_half:
		print(even)
	elif even > f_half:
		print(n - even)
	else:
		print(int(f_half))


def input_ints():
	return list(map(int, input().split()))

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	n = input()
	a = input_ints()
	cnt = [0, 0]
	for x in a:
		cnt[x % 2] += 1
	print(min(cnt))
main()


x = input()
list = input().split()
a = 0
b = 0
for x in list:
	m = int(x)
	if m % 2 == 1:
		a = a + 1
	else:
		b = b + 1
m = min(a, b)
print(m)


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
b = Counter([x % 2 for x in a])
print(min(b[0], b[1]))


N = int(input())
L = list(map(int, input().split()))
(OCOUNT, ECOUNT) = (0, 0)
for i in range(N):
	if L[i] % 2 == 0:
		ECOUNT += 1
	else:
		OCOUNT += 1
if ECOUNT > OCOUNT:
	print(OCOUNT)
else:
	print(ECOUNT)


from sys import stdin
input = stdin.buffer.readline
n = int(input())
arr = [int(x) for x in input().split()]
x = 0
for i in arr:
	if i % 2 == 0:
		x = x + 1
print(min(x, n - x))


from sys import stdin

def ip():
	return [int(i) for i in stdin.readline().split()]

def sp():
	return [str(i) for i in stdin.readline().split()]

def pp(A):
	for i in A:
		print(i)

def solve():
	n = int(input())
	A = ip()
	(o, e) = (0, 0)
	for i in A:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	return min(o, e)
print(solve())


n = int(input())
arr = list(map(int, input().split()))
n_odd = 0
n_even = 0
for x in arr:
	if x & 1:
		n_odd += 1
	else:
		n_even += 1
print(min(n_odd, n_even))


n = int(input())
arr = list(map(int, input().split()))
cnt = [0, 0]
for item in arr:
	if item % 2 == 0:
		cnt[0] += 1
	else:
		cnt[1] += 1
print(min(cnt))


n = int(input())
l = [int(x) % 2 for x in input().split()]
print(min(sum(l), n - sum(l)))


x = int(input())
a = list(map(int, input().split()))
odd = sum([1 if i % 2 != 0 else 0 for i in a])
even = sum([1 if i % 2 == 0 else 0 for i in a])
print(min(odd, even))


n = int(input())
ev = 0
lst = input().split()
lst = [int(x) for x in lst]
for i in lst:
	if i % 2 == 0:
		ev += 1
print(min(ev, n - ev))


n = int(input())
a = list(map(int, input().split()))
even = len(list(filter(lambda x: x % 2 == 0, a)))
odd = len(a) - even
print(min(odd, even))


n = int(input())
a = list(map(int, input().split()))
(ch, nch) = (0, 0)
for i in a:
	if i % 2:
		nch += 1
	else:
		ch += 1
print(min(ch, nch))


size = int(input())
arr = list(map(int, input().split()))
even = 0
odd = 0
for item in arr:
	if item % 2 == 0:
		even += 1
	else:
		odd += 1
if odd < even:
	print(odd)
else:
	print(even)


n = int(input())
ch = input()
L = ch.split()
p = 0
im = 0
for i in range(len(L)):
	if int(L[i]) % 2 == 0:
		p = p + 1
	else:
		im = im + 1
print(min(im, p))


n = int(input())
x = [int(i) for i in input().split()]
odd = [i for i in x if i % 2]
l = len(odd)
if n - l > l:
	print(l)
else:
	print(n - l)


n = int(input())
l = input()
l = l.split(' ')
odd = 0
for i in range(0, n):
	if int(l[i]) % 2 != 0:
		odd += 1
print(min(odd, n - odd))


n = int(input())
a = [int(i) for i in input().strip().split()]
c = 0
cmin = 101
for i in range(n):
	c = 0
	for j in range(n):
		if abs(a[i] - a[j]) % 2 == 0:
			continue
		else:
			c += 1
	if c < cmin:
		cmin = c
print(cmin)


import math

def main():
	n = int(input())
	x = list(map(int, input().split()))
	(odd, even) = (0, 0)
	for i in x:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(even, odd))
main()


c = []
n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
	l = 0
	for j in range(len(a)):
		if abs(a[i] - a[j]) % 2 == 1:
			l += 1
	c.append(l)
print(min(c))


n = int(input())
x = [int(i) for i in input().split()]
cnt1 = 0
cnt2 = 0
for i in range(n):
	if x[i] % 2 == 0:
		cnt1 += 1
	else:
		cnt2 += 1
print(min(cnt2, cnt1))


n = int(input())
L = list(map(int, input().split()))
m = 0
for i in range(n):
	if L[i] % 2 != 0:
		m += 1
print(min(m, n - m))


n = int(input())
lis = list(map(int, input().split()))
odd = 0
for x in lis:
	if x % 2 == 1:
		odd += 1
print(odd) if odd <= n - odd else print(n - odd)


n = int(input())
arr = [int(i) for i in input().split()]
ans = 10 ** 20
for i in range(n):
	cost = 0
	for j in range(n):
		cost += abs(arr[j] - arr[i]) % 2
	ans = min(cost, ans)
print(ans)


import sys
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def print_array(a):
	print(' '.join(map(str, a)))

def main():
	n = int(input())
	a = get_array()
	(e, o) = (0, 0)
	for i in a:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	print(min(e, o))
main()


n = int(input())
L = list(map(int, input().split()))
s = [0, 0]
for i in range(n):
	s[L[i] % 2] += 1
print(min(s[0], s[1]))


n = int(input())
even = 0
odd = 0
for elm in input().split(' '):
	elm = int(elm)
	if elm % 2 == 0:
		even += 1
	else:
		odd += 1
out = min(even, odd)
print(out)


from sys import stdin
input = stdin.readline
n = int(input())
arr = [*map(int, input().split())]
odd = 0
even = 0
for i in arr:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
arr = list(map(int, input().split()))
ans = []
for i in range(n):
	cur = arr[i]
	temp = 0
	for j in range(n):
		temp += abs(cur - arr[j]) % 2
	ans.append(temp)
print(min(ans))


m1 = 0
m2 = 0
n = int(input())
x = [int(i) for i in input().split()]
x.sort()
for i in range(0, n):
	if x[i] % 2 != 1:
		m1 = m1 + 1
	if x[i] % 2 == 1:
		m2 = m2 + 1
if m2 < m1:
	print(m2)
else:
	print(m1)


n = int(input())
lis = list(map(int, input().strip().split()))
memo = [0 for i in range(n)]
for i in range(n):
	for j in range(n):
		if i != j:
			if abs(lis[i] - lis[j]) % 2 != 0:
				memo[i] += 1
print(min(memo))


n = int(input())
arr_x = list(map(int, input().split()))
temp = [x % 2 for x in arr_x]
print(min(temp.count(0), temp.count(1)))


from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
c = Counter(a)
even = 0
odd = 0
for i in c:
	if i & 1:
		odd += c[i]
	else:
		even += c[i]
ans = 0
if odd > even:
	for i in c:
		if not i & 1:
			ans += c[i]
else:
	for i in c:
		if i & 1:
			ans += c[i]
print(ans)


n = int(input())
x = list(map(int, input().split()))
e = []
o = []
for j in x:
	if j % 2 == 0:
		e.append(j)
	else:
		o.append(j)
print(min(len(o), len(e)))


x = int(input())
y = list(map(int, input().split()))
l = []
m = []
for i in range(x):
	if y[i] & 1 == 1:
		l.append(y[i])
	else:
		m.append(y[i])
print(min(len(l), len(m)))


f = input()
n = input().split()
parni = 0
neparni = 0
for i in n:
	i = int(i)
	if i % 2 == 0:
		parni += 1
	else:
		neparni += 1
if parni > neparni:
	print(neparni)
else:
	print(parni)


t = int(input())
l1 = list(map(int, input().split()))
evn = 0
od = 0
for i in l1:
	if abs(i) % 2 == 0:
		evn = evn + 1
	else:
		od = od + 1
if evn >= od:
	print(od)
else:
	print(evn)


t = int(input())
p = list(map(int, input().split()))
n = len(p)
m = len(list(filter(lambda x: x % 2 == 0, p)))
print(min(m, n - m))


n = int(input())
l = [int(x) for x in input().split()]
odd = 0
for i in range(len(l)):
	if l[i] % 2 != 0:
		odd += 1
even = len(l) - odd
if odd < len(l) / 2:
	print(odd)
elif odd >= len(l) / 2:
	print(even)


n = int(input())
t = input()
l = list(t.split())
i = int(0)
count = int(0)
while i < n:
	l[i] = int(l[i])
	if l[i] % 2 == 0:
		count = count + 1
	i = i + 1
if count < n / 2:
	print(count)
else:
	print(n - count)


n = int(input())
d = list(map(int, input().split()))
(ch, nech) = (0, 0)
for i in d:
	if i % 2 == 0:
		ch += 1
	else:
		nech += 1
print(min(ch, nech))


n = int(input())
l1 = [int(num) for num in input().split()]
c1 = 0
c2 = 0
for j in range(n):
	if l1[j] % 2 == 0:
		c1 += 1
	else:
		c2 += 1
if c1 > c2:
	print(c2)
else:
	print(c1)


import sys
inp = []
for line in sys.stdin:
	inp.append(line.rstrip())
total_coin = int(inp[0])
coordinates = map(lambda x: int(x), inp[1].split(' '))
counter = 0
for coordinate in coordinates:
	counter += coordinate & 1
print(min(counter, total_coin - counter))


n = int(input())
a = list(map(int, input().split()))
odd = 0
for j in range(n):
	if a[j] % 2 != 0:
		odd += 1
print(min(odd, n - odd))


import operator
c = int(input())
cc = [int(x) for x in input().split()]
cc.sort()
elePar = {}
eleImp = {}
impares = 0
pares = 0
for k in cc:
	if k % 2 == 0:
		pares = pares + 1
	else:
		impares = impares + 1
if pares > impares:
	print(impares)
else:
	print(pares)


t = int(input())
b = list()
re = list()
b = list(map(int, input().split()))
for j in b:
	r = 0
	for k in b:
		if j == k:
			r += 0
		elif abs(j - k) % 2 == 0:
			r += 0
		else:
			r += 1
	re.append(r)
print(min(re))


n = int(input())
l = list(map(int, input().split()))
t = []
for x in range(len(l)):
	temp = []
	for y in range(len(l)):
		p = abs(l[y] - l[x])
		if p % 2 == 0:
			temp.append(0)
		else:
			temp.append(1)
	t.append(temp)
s = 100000000
for x in t:
	p = 0
	for y in x:
		p = p + y
	if p < s:
		s = p
print(s)


n = int(input())
lst = list(map(int, input().split(' ')))
ans = 0
ans2 = 0
base = lst[0]
for i in lst:
	if (i - lst[0]) % 2 == 1:
		ans += 1
		base = i
for i in lst:
	if (i - base) % 2 == 1:
		ans2 += 1
print(ans if ans < ans2 else ans2)


n = int(input())
arr = list(map(int, input().split()))
cnt = 0
for i in range(n):
	cnt += arr[i] % 2
print(min(cnt, n - cnt))


n = int(input())
A = [int(x) for x in input().split()]
a = sum(map(lambda x: x % 2, A))
print(min([a, len(A) - a]))


le = int(input())
s = input() + ' '
crnt = ''
b = []
left = []
right = []
for i in range(0, len(s)):
	if s[i] == ' ':
		b.append(int(crnt))
		crnt = ''
	else:
		crnt += s[i]
odd = 0
ch = 0
for i in b:
	if i % 2 == 0:
		odd += 1
	else:
		ch += 1
print(min(ch, odd))


t = int(input())
d = input()
d = d.split()
out = []
for i in range(0, t):
	d[i] = eval(d[i])
n = max(d) - min(d)
m = min(d)
for i in (0, n + 1):
	kq = 0
	for j in range(0, t):
		if abs(d[j] - m) % 2 == 1:
			kq = kq + 1
	out.append(kq)
	m = m + 1
print(min(out))


n = int(input())
chips = list(map(int, input().split()))
even = sum((1 for chip in chips if chip % 2 == 0))
print(min(even, n - even))


n = int(input())
l1 = list(map(int, input().split()))
max1 = 999999
for i in range(len(l1)):
	sum1 = 0
	for j in range(0, len(l1)):
		if abs(l1[j] - l1[i]) % 2 != 0:
			sum1 += 1
	max1 = min(sum1, max1)
print(max1)


n = int(input())
x = list(map(int, input().split()))
odd = []
even = []
for item in x:
	if item % 2 == 0:
		even.append(item)
	else:
		odd.append(item)
print(min(len(odd), len(even)))


n = int(input())
l = list(map(int, input().split()))
k = 999999999999999999999999999999999999999999
for x in range(n):
	p = 0
	for y in range(n):
		p += abs(l[x] - l[y]) % 2
	k = min(k, p)
print(k)


n = int(input())
l = list(map(int, input().split()))
c = 0
d = []
for i in l:
	d.append(i % 2)
v = sum(d)
print(min(v, n - v))


def coins(n, arr):
	evens = len(list(filter(lambda a: a % 2 == 0, arr)))
	odds = len(arr) - evens
	return min(evens, odds)
n = int(input())
arr = list(map(int, input().split()))
print(coins(n, arr))


import sys
input = sys.stdin.readline
from collections import Counter

def solve(n, chips):
	r = [c % 2 for c in chips]
	counts = Counter(r)
	if len(counts.values()) == 2:
		return min(counts.values())
	else:
		return 0
n = int(input())
chips = list(map(int, input().split()))
print(solve(n, chips))


def computecost(arr, n, x):
	cost = 0
	for i in range(n):
		d = abs(x - arr[i]) % 2
		cost = cost + d
	return cost

def ternary(arr, n):
	arr.sort()
	low = 0
	high = arr[len(arr) - 1]
	flag = 0
	while high - low > 2:
		flag = 1
		mid1 = low + (high - low) // 3
		mid2 = high - (high - low) // 3
		cost1 = computecost(arr, n, mid1)
		cost2 = computecost(arr, n, mid2)
		if cost1 < cost2:
			high = mid2
		else:
			low = mid1
	if flag == 0:
		i = 0
		cost3 = 4000
		v = 0
		while i < len(arr):
			v = arr.count(arr[i])
			val = computecost(arr, len(arr), arr[i])
			if val < cost3:
				cost3 = val
			i = i + v
		return cost3
	return computecost(arr, n, (high + low) // 2)
size = int(input())
arr = list(map(int, input().split()))
p = ternary(arr, size)
print(p)


input()
arr = list(map(int, input().split()))
nchet = 0
chet = 0
for i in arr:
	if abs(i) % 2:
		nchet += 1
	else:
		chet += 1
print(min(nchet, chet))


input()
nums = list(map(int, input().split()))
even = sum((1 for x in nums if x % 2 == 0))
odd = len(nums) - even
print(min(even, odd))


import math
n = int(input())
a = [int(s) for s in input().split()]
ch = 0
for i in range(n):
	if math.fabs(a[i]) % 2 == 0:
		ch += 1
if ch > n - ch:
	print(n - ch)
else:
	print(ch)


n = int(input())
l = list(map(int, input().split()))
count = 0
p = []
for i in range(n):
	count = 0
	for j in range(n):
		if i != j:
			s = l[i]
			t = abs(l[i] - l[j])
			if t % 2 == 0:
				continue
			else:
				count += 1
	p.append(count)
print(min(p))


useless = input()
nums = list(map(int, input().split()))
odds = len(list(filter(lambda x: x % 2 == 0, nums)))
print(min(len(nums) - odds, odds))


n = int(input())
li = list(map(int, input().split()))
li.sort()
a = 0
b = 0
for i in li:
	if i % 2 == 0:
		a += 1
	else:
		b += 1
if a < b:
	result = a * 1
else:
	result = b * 1
print(result)


n = int(input())
a = [int(x) for x in input().split()]
cnt = 0
for item in a:
	if item % 2 == 0:
		cnt += 1
print(min(cnt, n - cnt))


n = int(input())
arr = list(map(int, input().split()))
d = {}
for i in arr:
	d[i] = d.get(i, 0) + 1
a = sorted(d.keys())
ans = 10000
for i in range(0, len(a)):
	temp = [0 for i in range(len(a))]
	for j in range(0, len(a)):
		if j < i:
			temp[j] = (a[i] - a[j]) % 2 * d[a[j]]
		elif j > i:
			temp[j] = (a[j] - a[i]) % 2 * d[a[j]]
	ans = min(ans, sum(temp))
print(ans)


n = int(input())
l1 = [int(i) % 2 for i in input().split()][:n]
print(min(l1.count(0), l1.count(1)))


n = int(input())
a = list(map(int, input().split()))
counter = 0
counter2 = 0
for i in a:
	if i % 2 == 0:
		counter += 1
	else:
		counter2 += 1
print(min(counter2, counter))


n = int(input())
arr = input().split()
a = 0
b = 0
for i in arr:
	ans = int(i) % 2
	if ans == 0:
		a = a + 1
	else:
		b = b + 1
print(min(a, b))


n = int(input())
l = list(map(int, input().split()))
l.sort()
maxpt = 1000000
for i in range(n):
	pt = 0
	for j in range(n):
		if l[i] != l[j]:
			x = abs(l[i] - l[j])
			pt += x % 2
	maxpt = min(maxpt, pt)
print(maxpt)


n = int(input())
arr = list(map(int, input().split()))
(e, o) = (0, 0)
for ele in arr:
	if ele % 2 == 0:
		e += 1
	else:
		o += 1
print(min(o, e))


import sys
n = int(sys.stdin.readline())
a = [int(i) for i in sys.stdin.readline().split()]
a.sort()
ans = n - 1
for p in range(n):
	c = 0
	for q in range(n):
		if abs(a[p] - a[q]) % 2 != 0:
			c += 1
	ans = min(ans, c)
print(ans)


n = int(input())
l1 = list(map(int, input().split()))
ans = 0
ans2 = 0
for i in range(n):
	if l1[i] % 2 == 0:
		ans += 1
	else:
		ans2 += 1
print(min(ans, ans2))


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
l = I()
ans = MOD
for i in range(n):
	x = l[i]
	c = 0
	for i in l:
		c += abs(x - i) % 2
	ans = min(ans, c)
print(ans)


n = int(input())
l = list(map(int, input().split()))
(odd, even) = (0, 0)
for a in l:
	if a % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


import sys
from collections import Counter
n = input()
s = Counter(list(map(lambda x: int(x) % 2, sys.stdin.readline().split())))
print(min(s.get(1, 0), s.get(0, 0)))


input()
a = list(map(int, input().split()))
ce = co = 0
for i in a:
	if i % 2 == 0:
		ce += 1
	else:
		co += 1
print(min(ce, co))


import sys

def main():
	n = int(sys.stdin.readline().strip())
	xs = [int(s) for s in sys.stdin.readline().strip().split()]
	odd = sum((x % 2 for x in xs))
	even = sum(((x + 1) % 2 for x in xs))
	print(min(odd, even))
main()


cn = int(input())
numbers = [int(i) for i in input().split()]
min_count_uneven = cn
for number in numbers:
	count = 0
	for num in numbers:
		if abs(number - num) % 2 == 1:
			count += 1
	if count < min_count_uneven:
		min_count_uneven = count
print(min_count_uneven)


n = int(input())
if n == 1:
	print(0)
	exit()
arr = list(map(int, input().strip().split()))[:n]
odd = even = 0
for i in arr:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
a = [int(x) for x in input().split(' ')]
odd = len([x for x in a if x % 2 == 1])
even = n - odd
if odd > even:
	print(even)
else:
	print(odd)


N = int(input())
L = list(map(int, input().split()))
E = sum(map(lambda x: x % 2 == 0, L))
print(min(E, N - E))


n = int(input())
lst = [int(i) for i in input().split()]
qupos1 = 0
qu0 = 0
for (ind, i) in enumerate(lst):
	if i % 2 == 0:
		qu0 += 1
	else:
		qupos1 += 1
print(min(qupos1, qu0))


a = int(input())
b = sum((int(j) % 2 for j in input().split()))
print(min(b, a - b))


from sys import stdin
import math

def inp():
	return stdin.readline().strip()
n = int(inp())
ar = [int(x) for x in inp().split()]
ar.sort()
even = 0
odd = 0
for i in range(n):
	if ar[i] % 2 == 0:
		even += 1
	if ar[i] % 2 == 1:
		odd += 1
if even > odd:
	print(odd)
elif odd > even:
	print(even)
elif odd == even:
	print(even)


import sys
import os
from io import IOBase, BytesIO

def main():
	n = int(input())
	arr = get_array()
	(even, odd) = (0, 0)
	for i in arr:
		if i % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(even, odd))
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


from collections import Counter, defaultdict
BS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def to_base(s, b):
	res = ''
	while s:
		res += BS[s % b]
		s //= b
	return res[::-1] or '0'
alpha = 'abcdefghijklmnopqrstuvwxyz'
from math import floor, ceil, pi
import sys
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]
import timeit

def primef(n, plst=[]):
	if n == 1:
		return plst
	else:
		for m in primes:
			if n % m == 0:
				return primef(n // m, plst + [m])
		return primef(1, plst + [n])

def lmii():
	return list(map(int, input().split()))

def ii():
	return int(input())

def countOverlapping(string, sub):
	count = start = 0
	while True:
		start = string.find(sub, start) + 1
		if start > 0:
			count += 1
		else:
			return count
n = ii()
nums = lmii()
tot = 0
for i in nums:
	if i % 2 == 0:
		tot += 1
print(min(tot, n - tot))


import sys
from collections import Counter

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
N = INT()
A = LIST()
cnt = 0
for a in A:
	if a % 2 == 0:
		cnt += 1
ans = min(cnt, N - cnt)
print(ans)


N = int(input())
L = list(map(int, input().strip().split()))
P = 0
D = 0
for n in range(0, N):
	a = L[n]
	if a % 2 == 0:
		P += 1
	else:
		D += 1
if P < D:
	print(P)
else:
	print(D)


n = int(input())
arr = list(map(int, input().split()))
odd = 0
even = 0
for el in arr:
	if el % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


N = int(input())
k = sum((i & 1 for i in map(int, input().split())))
print(min(k, N - k))


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from heapq import heappush as hpush
from heapq import heappop as hpop
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
n = ri(1)
a = ri()
odd = sum([i % 2 for i in a])
even = n - odd
print(min(even, odd))


n = int(input())
l = [int(x) for x in input().split()]
ecount = ocount = 0
for i in range(n):
	if l[i] % 2 == 0:
		ecount = ecount + 1
	else:
		ocount = ocount + 1
print(min(ecount, ocount))


n = int(input())
list1 = list(map(int, input().split()))
odd_count = len(list(filter(lambda x: x % 2 != 0, list1)))
even_count = len(list(filter(lambda x: x % 2 == 0, list1)))
print(min(odd_count, even_count))


n = int(input())
it = list(map(int, input().split()))
a = len([i for i in it if i % 2 == 0])
b = n - a
if a >= b:
	print(b)
else:
	print(a)


n = int(input())
x = list(map(int, input().split()))
zero = sum((a % 2 == 0 for a in x))
one = sum((a % 2 == 1 for a in x))
print(min(zero, one))


n = int(input())
a = [int(x) for x in input().split()]
(p, i) = (0, 0)
for x in a:
	p += int(1 - x % 2)
	i += int(x % 2)
print(min(i, p))


t = int(input())
lis = list(map(int, input().split()))
mi = []
s = set(lis)
for m in s:
	coin = 0
	for x in lis:
		if x != m:
			dif = abs(m - x)
			r = dif % 2
			coin = coin + r
	mi.append(coin)
print(min(mi))


n = int(input())
l = list(map(int, input().split()))
a = 0
b = 0
for i in range(n):
	if l[i] % 2 != 0:
		a = a + 1
	else:
		b = b + 1
if a <= b:
	print(a)
else:
	print(b)


input()
arr = list(map(int, input().split()))
odd = len(list((i for i in arr if i % 2 == 1)))
print(min(odd, len(arr) - odd))


n = int(input())
l = list(map(int, input().split()))
odd = 0
for i in l:
	if i & 1 == 1:
		odd += 1
print(min(odd, n - odd))


N = int(input())
nums = [int(x) for x in input().split()]
o = 0
e = 0
for i in nums:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
print(min(o, e))


n = int(input())
l = list(map(int, input().split()))
eve = 0
odd = 0
for i in l:
	if i % 2 == 0:
		eve += 1
	else:
		odd += 1
if eve >= odd:
	for i in l:
		if i % 2 == 0:
			t = i
			break
else:
	for i in l:
		if i % 2 != 0:
			t = i
			break
co = 0
for i in l:
	if abs(t - i) % 2 != 0:
		co += 1
print(co)


_ = input()
arr = [int(i) for i in input().split()]
x = sum((i % 2 for i in arr))
print(min(x, len(arr) - x))


t = int(input())
minn = 10 ** 9 + 7
ss = sorted([int(i) for i in input().split()])
for i in range(0, len(ss)):
	(b, a, pr) = (0, 0, ss[i])
	for j in range(0, i):
		if (ss[j] - pr) % 2 == 0:
			continue
		b += 1
	for j in range(i, len(ss)):
		if (ss[j] - ss[i]) % 2 == 0:
			continue
		a += 1
	s1 = a + b
	minn = min(s1, minn)
print(minn)


n = int(input())
l = list(map(int, input().split()))
even = 0
odd = 0
s = list(set(l))
for i in s:
	if abs(i) % 2 == 0:
		even = even + l.count(i)
	else:
		odd = odd + l.count(i)
if even > odd:
	print(odd)
else:
	print(even)


n = int(input().strip())
ns = [int(x) for x in input().strip().split()]
o = len([x for x in ns if x % 2 == 1])
e = len([x for x in ns if x % 2 == 0])
print(min(o, e))


import unittest

def solve(n, x):
	cnto = cnte = 0
	for i in x:
		if i % 2 == 0:
			cnto += 1
		else:
			cnte += 1
	return min(cnto, cnte)

class TestCase(unittest.TestCase):

	def test1(self):
		n = 3
		x = [1, 2, 2]
		self.assertEqual(solve(n, x), 1)
n = int(input())
x = [int(i) for i in input().split()]
print(solve(n, x))


def calc():
	print()

def main():
	n: int = int(input())
	arr: tuple = tuple(map(int, input().split()))
	even: int = 0
	for i in arr:
		if i % 2 == 0:
			even += 1
	print(min(even, abs(n - even)))
main()


num = input()
is_even = [int(i) % 2 == 0 for i in input().split(' ')]
even = sum(is_even)
odd = len(is_even) - even
res = odd if odd < even else even
print(res)


n = int(input())
evenCount = 0
oddCount = 0
for x in input().strip().split():
	if int(x) % 2 == 0:
		evenCount += 1
	else:
		oddCount += 1
print(min(evenCount, oddCount))


import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list(map(int, input().split()))
c = 0
for i in range(n):
	if l[i] % 2 == 1:
		c += 1
print(min(c, n - c))


n = int(input())
a = [int(i) for i in input().split()]
cnto = 0
cnte = 0
for i in range(n):
	if a[i] % 2 == 0:
		cnte += 1
	else:
		cnto += 1
print(min(cnto, cnte))


n = int(input())
l = [int(i) for i in input().split()]
k = sum((1 for x in l if x % 2 == 0))
print(min(k, n - k))


n = int(input())
xi = list(map(int, input().split()))
xi2 = [xi[i] % 2 * 2 - 1 for i in range(n)]
print(min((n - sum(xi2)) // 2, (n + sum(xi2)) // 2))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	n = N()
	ar = lis()
	o = 0
	e = 0
	for i in ar:
		if i % 2 == 0:
			e += 1
		else:
			o += 1
	print(min(o, e))
solve()


number = int(input())
count = 0
data = input()
data_list = data.split()
for i in range(number):
	if int(data_list[i]) % 2 == 0:
		count += 1
if count <= number / 2:
	print(count)
else:
	print(number - count)


n = int(input())
chips = {}
for x in input().split():
	if int(x) in chips:
		chips[int(x)] += 1
		continue
	chips[int(x)] = 1
keys = chips.keys()
twos = 0
ones = 0
for c in keys:
	if c % 2 == 0:
		twos += chips[c]
	else:
		ones += chips[c]
if ones < twos:
	print(ones)
else:
	print(twos)


import sys
from math import fabs
n = int(input())
x = sys.stdin.readline().rstrip()
x = list(map(int, x.split()))
counts = dict()
for elem in x:
	ct = x.count(elem)
	counts[elem] = ct
min_cost = sys.maxsize
for key1 in counts:
	cost = 0
	for key2 in counts:
		cur_cost = 0
		if key1 != key2:
			d = fabs(key1 - key2)
			if d % 2:
				cur_cost = 1
			cost += cur_cost * counts[key2]
	min_cost = int(min(cost, min_cost))
print(min_cost)


n = int(input())
x = list(map(int, input().split()))
(oddCount, evenCount) = (0, 0)
for i in x:
	if i % 2 == 0:
		evenCount += 1
	else:
		oddCount += 1
print(min(oddCount, evenCount))


n = int(input())
lst = list(map(int, input().split()))
c = 0
o = e = 0
for i in lst:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
print(min(o, e))


x = int(input())
y = input().split(' ')
k = []
for i in range(x):
	k.insert(i, int(y[i]))
c = 0
d = 0
for i in range(x):
	if k[i] % 2 == 0:
		c = c + 1
	else:
		d = d + 1
if c < d:
	print(c)
else:
	print(d)


def process(A, n):
	odd = 0
	even = 0
	for i in A:
		if i % 2 == 0:
			even = even + 1
		else:
			odd = odd + 1
	return min(odd, even)
n = int(input())
A = [int(x) for x in input().split()]
print(process(A, n))


n = int(input())
a = [int(x) for x in input().split()]
ans = 0
ans1 = 0
for i in range(n):
	if a[i] % 2 == 0:
		ans += 1
	else:
		ans1 += 1
print(min(ans, ans1))


q = int(input())
a = list(map(int, input().split()))
l = 0
m = 0
for i in range(0, q):
	if a[i] % 2 == 0:
		l += 1
	else:
		m += 1
if l >= m:
	print(m)
else:
	print(l)


read = lambda : [int(i) for i in input().split()]
n = int(input())
a = read()
odd = sum([1 for i in a if i % 2])
if odd > n - odd:
	print(n - odd)
else:
	print(odd)


n = int(input())
s = input()
arr = [int(x) for x in s.split()]
even = []
odd = []
for num in arr:
	if num % 2 == 0:
		even.append(num)
	else:
		odd.append(num)
if len(even) == 0 or len(odd) == 0:
	print(0)
else:
	print(min(len(even), len(odd)))


n = int(input())
arr = list(map(int, input().split()))
coun1 = 0
coun2 = 0
for i in arr:
	if i % 2 == 0:
		coun1 += 1
	else:
		coun2 += 1
print(min(coun1, coun2))


n = int(input())
arr = [int(i) for i in input().split()]
e = 0
for i in range(len(arr)):
	if arr[i] % 2 == 0:
		e = e + 1
print(min(e, n - e))


N = int(input())
X = map(int, input().split())
cnt1 = 0
cnt2 = 0
for i in X:
	if i % 2 == 0:
		cnt1 += 1
	else:
		cnt2 += 1
print(min(cnt1, cnt2))


input()
str = input()
odd = [int(x) for x in str.split() if int(x) % 2 == 1]
even = [int(x) for x in str.split() if int(x) % 2 == 0]
print(min(len(even), len(odd)))


n = int(input())
chips = list(map(int, input().split()))
chips.sort()
coins = []
for i in range(0, len(chips)):
	coin = 0
	for j in range(0, len(chips)):
		if abs(chips[i] - chips[j]) % 2 == 0:
			pass
		else:
			coin = coin + 1
	coins.append(coin)
print(min(coins))


n = int(input())
m = [0, 0]
l = list(map(int, input().split()))
for i in l:
	m[i % 2] += 1
print(min(m))


n = int(input())
chips = [int(x) for x in input().split()]
a = 0
for i in chips:
	if i % 2 == 1:
		a += 1
print(min(a, n - a))


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	a = list(map(lambda x: int(x) & 1, stdin.readline().split()))
	odd = a.count(1)
	print(min(odd, n - odd))


R = lambda : map(int, input().split())
n = int(input())
L = list(R())
(o, e) = (0, 0)
for i in L:
	if i % 2:
		o += 1
	else:
		e += 1
print(min(o, e))


n = int(input())
l = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in l:
	if i % 2 == 0:
		count1 += 1
	else:
		count2 += 1
if count1 == n or count2 == n:
	print('0')
elif count1 > count2:
	print(count2)
else:
	print(count1)


n = int(input())
x = list(map(int, input().split(' ')))
a = list(filter(lambda k: k % 2 == 0, x))
b = list(filter(lambda k: k % 2 == 1, x))
print(min(len(a), len(b)))


n = int(input())
x = list(map(int, input().split()))
ec = 0
for i in x:
	ec += 1 if i % 2 == 0 else 0
oc = n - ec
print(oc if ec > oc else ec)


from math import sqrt
from random import randint

def ip(n):
	if n == 1:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def s2(n):
	a = list(range(n))
	a[1] = 0
	for i in a:
		if i > 1:
			for j in range(i * 2, len(a), i):
				a[j] = 0
	return {i ** 2 for i in a}
x = int(input())
y = [int(i) % 2 for i in input().split()]
e = 0
o = 0
for i in y:
	if i == 1:
		o += 1
	else:
		e += 1
print(min(e, o))


n = int(input())
lista = [int(i) for i in input().split()]
impar = 0
par = 0
for i in lista:
	if i % 2 == 0:
		par += 1
	else:
		impar += 1
if impar >= par:
	print(par)
else:
	print(impar)


n = int(input())
a = list(map(int, input().split()))
ll = 0
lc = 0
for i in range(n):
	if a[i] % 2 == 0:
		lc += 1
	else:
		ll += 1
print(min(ll, lc))


n = int(input())
m = input().split()
p = 0
ip = 0
for i in m:
	if i[-1] in '02468':
		p += 1
	else:
		ip += 1
if p >= ip:
	print(ip)
else:
	print(p)


num = input()
line = input()
line = line + ' '
temp = ''
a = 0
for char in line:
	if char == ' ':
		if not int(temp) % 2:
			a = a + 1
		temp = ''
	else:
		temp = temp + char
print(min(int(num) - a, a))


x = int(input())
y = list(map(int, input().split()))
ans = 0
for i in y:
	if i & 1:
		ans += 1
print(min(ans, x - ans))


n = int(input())
inputlist = [int(x) for x in input().split()]
outputlist = [0] * n
for a in range(n):
	if inputlist[a] % 2 == 0:
		inputlist[a] = 4
	else:
		inputlist[a] = 3
for a in range(n):
	for b in range(n):
		if inputlist[a] == inputlist[b]:
			outputlist[a] += 1
outputlist.sort()
if outputlist[0] == n:
	print(0)
else:
	print(outputlist[0])


x = int(input())
l = list(map(int, input().split()))
o = 0
for i in range(x):
	if l[i] % 2 != 0:
		o += 1
ans = min(o, x - o)
print(ans)


n = int(input())
s = input().split(' ')
a = 0
b = 0
for i in s:
	if int(i) % 2 == 0:
		a += 1
	else:
		b += 1
print(min(a, b))


n = int(input())
arr = list(map(int, input().split()))
co = 0
for i in arr:
	if i % 2 == 0:
		co += 1
print(min(co, n - co))


n = int(input())
chips = list(map(int, input().split()))
odds = sum((x & 1 for x in chips))
evens = n - odds
print(min(odds, evens))


n = int(input())
s = input()
arr = s.split(' ')
for i in range(len(arr)):
	arr[i] = int(arr[i])
minm = 10000000000
for j in range(len(arr)):
	count = 0
	for k in range(len(arr)):
		if arr[k] > arr[j] and k != j:
			if (arr[k] - arr[j]) % 2 != 0:
				count += 1
		elif arr[k] < arr[j] and k != j:
			if (arr[j] - arr[k]) % 2 != 0:
				count += 1
	if count < minm:
		minm = count
print(minm)


n = int(input())
l = [int(i) for i in input().split()]
p = 0
imp = 0
for i in range(n):
	if l[i] % 2 != 0:
		imp += 1
	else:
		p += 1
if p > imp:
	print(imp)
else:
	print(p)


from sys import stdin
input = stdin.readline
n = int(input())
l = list(map(int, input().split()))
c = 0
for i in l:
	if i % 2 == 1:
		c += 1
print(min(c, n - c))


n = int(input())
odd = 0
even = 0
inp = input().split(' ')
for i in inp:
	cur = int(i)
	if cur % 2:
		odd += 1
	else:
		even += 1
print(min(odd, even))


n = int(input())
a = list(map(int, input().split()))
c = 2147483647
for i in range(n):
	p = 0
	for j in range(n):
		if abs(a[j] - a[i]) % 2 != 0:
			p += 1
	c = min(c, p)
print(c)


i = int(input())
l = list(map(lambda a: int(a) % 2, input().split()))
odd = l.count(1)
print(min(odd, len(l) - odd))


n = int(input())
p = sum([int(v) % 2 for v in input().split()])
print(min(p, n - p))


input()
x = map(int, input().split())
cnt = [0, 0]
for s in x:
	cnt[s & 1] += 1
print(min(cnt))


n = int(input())
array = [int(itm) for itm in input().split()]
array.sort()
ans = 0
for i in array:
	if i % 2 == 0:
		ans += 1
print(min(ans, n - ans))


from sys import stdin, stdout
n = stdin.readline()
a = [int(x) for x in stdin.readline().split()]
c = 0
d = 0
for i in range(len(a)):
	if a[i] % 2 != 0:
		c += 1
	else:
		d += 1
stdout.write(str(min(c, d)))


n = int(input())
a = list(map(int, input().split()))
a.sort()
b = list(set(a))
d = dict()
for i in a:
	d[i] = 0
for i in a:
	d[i] += 1
c1 = 0
c2 = 0
mid1 = b[len(b) // 2 - 1]
mid2 = b[len(b) // 2]
for i in b:
	if mid1 & 1 != i & 1:
		c1 += d[i]
	if mid2 & 1 != i & 1:
		c2 += d[i]
print(min(c1, c2))


n = int(input())
arr = list(map(int, input().split()))
amount = 0
amount_2 = 0
for elem in arr:
	if elem % 2 == 0:
		amount += 1
	else:
		amount_2 += 1
print(min(amount, amount_2))


def solve(n, m):
	odd = 0
	for x in m:
		if x % 2 == 1:
			odd += 1
	return min(odd, n - odd)
n = int(input())
s = input()
m = list(map(int, s.split()))
o = solve(n, m)
print(o)


n = int(input())
arr = list(map(int, input().rstrip().split()))
coins = 0
arr.sort()
store = []
for i in range(len(arr)):
	sel = arr[i]
	coins = 0
	for j in range(len(arr)):
		if arr[j] == sel:
			continue
		elif (arr[j] - sel) % 2 == 0:
			continue
		elif (arr[j] - sel) % 2 != 0:
			coins += 1
	store.append(coins)
print(min(store))


N = int(input())
A = list(map(int, input().split()))
Number_odd = 0
Number_even = 0
for i in range(N):
	if A[i] % 2 == 0:
		Number_even = Number_even + 1
	if A[i] % 2 == 1:
		Number_odd = Number_odd + 1
if Number_even > Number_odd:
	print(Number_odd)
if Number_odd >= Number_even:
	print(Number_even)


b = lambda : input().split()
b()
_1 = 0
_2 = 0
for i in map(int, b()):
	if i % 2:
		_1 += 1
	else:
		_2 += 1
print(min(_1, _2))


import math
n = int(input())
a = list(map(int, input().split()))
c = list(filter(lambda x: x % 2 == 0, a))
print(min(len(c), n - len(c)))


n = int(input())
a = list(map(int, input().split()))
chet = 0
nechet = 0
for i in a:
	if i % 2 == 0:
		chet += 1
	else:
		nechet += 1
if chet > nechet:
	print(nechet)
else:
	print(chet)


(_, c) = (input(), [0, 0])
for s in input().split():
	c[ord(s[-1]) & 1] += 1
print(min(c))


import sys
input = sys.stdin.readline
from collections import Counter
n = int(input())
arr = [int(i) for i in input().split()]
count1 = 0
for i in arr:
	if i % 2 == 0:
		count1 += 1
count2 = n - count1
if count1 >= count2:
	print(count2)
else:
	print(count1)


n = int(input())
a = [int(x) for x in input().split()]
ec = 0
oc = 0
for x in a:
	if x % 2 == 0:
		ec += 1
	else:
		oc += 1
if ec > oc:
	print(oc)
else:
	print(ec)


n = int(input())
chips = list(map(int, input().split()))
evens = 0
odds = 0
for chip in chips:
	if chip % 2 == 0:
		evens += 1
	else:
		odds += 1
if evens <= odds:
	print(evens)
else:
	print(odds)


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	n = rsingle_int()
	a = rmult_int()
	n_even = 0
	n_odd = 0
	for el in a:
		if el % 2 == 0:
			n_even += 1
		else:
			n_odd += 1
	if n_even > n_odd:
		print(n_odd)
	else:
		print(n_even)
main()


N = int(input())
mas = input().split()
mas = list(map(int, mas))
number_odd = 0
number_even = 0
for i in range(N):
	if mas[i] % 2 == 0:
		number_even += 1
	else:
		number_odd += 1
if number_even >= number_odd:
	result = number_odd
else:
	result = number_even
print(result)


n = int(input())
odd = 0
even = 0
inp = list(map(int, input().split()))
sorted(inp)
first = inp[0]
for j in range(n):
	if inp[j] % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


m = int(input())
list = list(map(int, input().split()))
l = 0
r = 0
for i in range(len(list)):
	if list[i] % 2 != 0:
		l += 1
	else:
		r += 1
print(min(l, r))


from collections import defaultdict
n = int(input())
chips = [int(x) for x in input().split(' ')]
counts = defaultdict(int)
for x in chips:
	counts[x] += 1
min_total = None
for key in counts:
	total_coins = 0
	for (k, v) in counts.items():
		offset = abs(key - k)
		total_coins += offset % 2 * v
	if min_total is None or min_total > total_coins:
		min_total = total_coins
print(min_total)


n = int(input())
a = [int(e) for e in input().split()]
c1 = 0
c2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		c1 += 1
	else:
		c2 += 1
print(min(c1, c2))


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b):
	return abs(a[0] - b[0]) + abs(b[1] - a[1])

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def eld(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()

def fac(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
		ans %= MOD
	return ans
n = int(input())
a = arrIN()
s = set(a)
mn = MAX
for i in s:
	ans = 0
	for j in a:
		x = abs(j - i)
		if x % 2:
			ans += 1
	mn = min(mn, ans)
print(mn)


n = int(input())
a1 = 0
a2 = 0
x = list(map(int, list(input().split())))
for i in range(n):
	x1 = x[i]
	if x1 % 2 == 0:
		a2 = a2 + 1
	else:
		a1 = a1 + 1
if a1 > a2:
	print(a2)
else:
	print(a1)


n = int(input())
lista = [int(x) for x in input().split()]
out = [0] * n
for x in range(n):
	if lista[x] % 2 == 0:
		lista[x] = 2
	else:
		lista[x] = 1
for x in range(n):
	for i in range(n):
		if lista[x] == lista[i]:
			out[x] += 1
out.sort()
if out[0] == n:
	print(0)
else:
	print(out[0])


class Solution:

	def __init__(self):
		self.n = int(input())
		self.x = [int(x) for x in input().split()]

	def solve_and_print(self):
		odd_cnt = sum((1 for xi in self.x if xi & 1))
		print(min(odd_cnt, self.n - odd_cnt))
Solution().solve_and_print()


def dprint(*ar):
	pass
N = int(input())
vX = list(map(int, input().split()))
odds = sum((x % 2 for x in vX))
evens = N - odds
print(min(odds, evens))


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
ls = list(map(int, input().split()))
odd = even = 0
for i in ls:
	if i % 2:
		odd += 1
even = len(ls) - odd
print(min(odd, even))


n = int(input())
a = list(map(int, input().split()))
mn = 100000000000
a.sort()
for i in range(n):
	cst = 0
	for j in range(n):
		cst += (a[j] - a[i]) % 2
	if cst < mn:
		mn = cst
print(mn)


from collections import defaultdict as DD
from bisect import bisect_left as BL
from bisect import bisect_right as BR
from itertools import combinations as IC
from itertools import permutations as IP
from random import randint as RI
import sys
MOD = pow(10, 9) + 7

def IN(f=0):
	if f == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
n = IN(1)
a = IN()
q = 0
w = 0
for i in range(n):
	if a[i] % 2 == 0:
		q += 1
	else:
		w += 1
print(min(q, w))


nc = int(input())
x = [int(i) for i in input().split()]
par = 0
impar = 0
for i in x:
	if i % 2 == 0:
		par += 1
	else:
		impar += 1
print(min(par, impar))


n = int(input())
array = list(map(int, input().split()))
count_odd = 0
for i in array:
	if i % 2:
		count_odd += 1
count_even = n - count_odd
print(min(count_odd, count_even))


n = int(input())
v = list(map(int, input().split()))
a = []
b = []
for x in v:
	a.append(x) if x & 1 else b.append(x)
print(min(len(a), len(b)))


def int_multiple():
	return [int(c) for c in input().split()]

def int_single():
	return int(input())

def str_multiple():
	return [c for c in input().split()]

def str_single():
	return input()
n = int_single()
l = int_multiple()
odd = 0
even = 0
for i in range(n):
	if l[i] % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, even))


input()
s = [int(n) % 2 for n in input().split()]
print(min(s.count(0), s.count(1)))


def problem():
	n = int(input())
	arr = [int(x) for x in input().split(' ')]
	_odd = 0
	_even = 0
	for i in arr:
		if abs(i) % 2 == 0:
			_even += 1
		else:
			_odd += 1
	print(min(_odd, _even))
problem()


import sys
import collections
import functools
n = int(input().strip())
data = list(map(int, input().strip().split()))
(odd, even) = (0, 0)
for i in data:
	if i % 2:
		odd += 1
	else:
		even += 1
if even == 0 or odd == 0:
	print(0)
else:
	print(min(even, odd))


n = int(input())
x = list(map(int, input().split()))
(c, g) = (0, 0)
for i in range(n):
	if x[i] % 2 == 0:
		c += 1
	else:
		g += 1
print(min(c, g))


input()
arr = list(map(int, input().split()))
(ev, od) = (0, 0)
for i in arr:
	if i % 2 == 0:
		ev += 1
	else:
		od += 1
print(min(ev, od))


num = int(input())
chips = [int(i) for i in input().split()]
min = 100000
for i in range(num):
	val = 0
	for j in range(num):
		val += abs(chips[i] - chips[j]) % 2
	if val < min:
		min = val
print(min)


n = int(input())
arr = list(map(int, input().split()))
lis = []
for i in arr:
	cntm = 0
	for j in arr:
		if abs(i - j) % 2 == 1:
			cntm += 1
	lis.append(cntm)
print(min(lis))


n = int(input())
x = [int(i) for i in input().split()]
even = 0
odd = 0
for num in x:
	even += 1 if num % 2 == 0 else 0
	odd += 1 if num % 2 == 1 else 0
print(even if even <= odd else odd)


n = int(input())
a = list(map(int, input().split()))
a.sort()
c = 0
d1 = 0
for i in range(n):
	if a[i] % 2 == 0:
		c += 1
	else:
		d1 += 1
print(min(d1, c))


n = int(input())
s = map(int, input().split())
s = list(s)
chet = []
nechet = []
for i in range(n):
	if s[i] % 2 == 0:
		chet.append(s[i])
	else:
		nechet.append(s[i])
if len(chet) <= len(nechet):
	print(len(chet))
else:
	print(len(nechet))


n = int(input().strip())
a = [int(i) for i in input().strip().split(' ')]
even = sum((1 for c in a if c % 2 == 0))
print(min(even, n - even))


n = int(input())
k = sum([int(s) % 2 for s in input().split()])
print(min(k, n - k))


n = int(input())
ganjil = 0
genap = 0
arr = list(map(int, input().split()))
for i in range(n):
	tmp = arr[i]
	if tmp % 2 == 0:
		ganjil += 1
	else:
		genap += 1
print(min(ganjil, genap))


n = int(input())
k = input().split()
for i in range(n):
	k[i] = int(k[i])
x = set(k)
min0 = 9999999999999999999
for i in x:
	sum0 = 0
	for j in k:
		sum0 += abs(i - j) % 2
	if sum0 < min0:
		min0 = sum0
print(min0)


n = int(input())
a = list(map(int, input().split()))
pair = 0
impair = 0
for i in a:
	if i % 2:
		impair += 1
	else:
		pair += 1
print(min(pair, impair))


n = int(input())
a = [int(x) for x in input().split()]
b = set(a)
c = []
for i in b:
	sum1 = 0
	for j in a:
		if abs(i - j) % 2 == 0:
			sum1 += 0
		else:
			sum1 += 1
	c.append(sum1)
print(min(c))


from sys import stdin, stdout
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().split()))
(ce, co) = (0, 0)
for i in l:
	co += i % 2
	ce += 1 - i % 2
if ce == 0 or co == 0:
	stdout.write(str(0))
else:
	stdout.write(str(min(co, ce)))


number = int(input(''))
list_1 = input('').split()
cost_list = []
for i in list_1:
	cost = 0
	number = i
	list_2 = list_1.copy()
	tar_num = list_2.pop(list_1.index(i))
	dis_list = [abs(int(i) - int(tar_num)) for i in list_2]
	for j in dis_list:
		if j % 2 != 0:
			cost += 1
	cost_list.append(cost)
print(min(cost_list))


from statistics import mode
n = int(input())
coordinates = sorted([int(i) for i in input().split()])
distinct = list(set(coordinates))
costs = float('inf')
for i in range(len(distinct)):
	temp = 0
	for j in range(len(coordinates)):
		if distinct[i] == coordinates[j]:
			continue
		elif (distinct[i] - coordinates[j]) % 2 == 0:
			continue
		elif (distinct[i] - coordinates[j]) % 2 != 0:
			temp += 1
	costs = min(costs, temp)
print(costs)


N = int(input())
S = list(map(int, input().split()))
dp = [0, 0]
x = 0
while x < len(S):
	if S[x] % 2 == 0:
		dp[1] += 1
	else:
		dp[0] += 1
	x += 1
print(min(dp))


n = int(input())
sp = list(map(int, input().split()))
kol1 = 0
kol2 = 0
for i in range(len(sp)):
	if sp[i] % 2 == 0:
		kol1 += 1
	else:
		kol2 += 1
print(min(kol1, kol2))


n = int(input())
a = [int(x) for x in input().split()]
s = 0
d = {}
mx = 45131321313
for i in set(a):
	hopa = 0
	for j in range(len(a)):
		hopa += (a[j] - i) % 2
	mx = min(hopa, mx)
print(mx)


n = int(input())
a = list(map(int, input().split()))
m = max(a)
o = e = 0
for i in a:
	if (m - i) % 2 == 0:
		e += 1
	else:
		o += 1
print(min(e, o))


input()
s = d = 0
for i in input().split(' '):
	if int(i) & 1:
		s += 1
	else:
		d += 1
print(min(s, d))


numOfChips = int(input())
chips = input().split(' ')
odd = 0
even = 0
for i in chips:
	if int(i) % 2 == 0:
		odd += 1
	else:
		even += 1
print(min(odd, even))


import sys
input = sys.stdin.readline
from collections import *
n = int(input())
x = list(map(int, input().split()))
e = 0
for xi in x:
	if xi % 2 == 0:
		e += 1
print(min(e, n - e))


n = int(input())
a = list(map(int, input().split()))
X = 0
Y = 0
for i in range(n):
	if a[i] % 2 == 0:
		X += 1
	else:
		Y += 1
print(min(X, Y))


import sys
n = int(input())
arr = list(map(int, input().split()))
arr = sorted(arr)
Ans = sys.maxsize
for i in range(n):
	ans = 0
	for j in range(n):
		if i != j:
			if abs(arr[i] - arr[j]) % 2 == 1:
				ans += 1
	Ans = min(ans, Ans)
print(Ans)


l = int(input())
a = []
a = [int(x) for x in input().split()]
max = []
for i in list(range(l)):
	nu = a[i]
	odd = 0
	for (j, _) in enumerate(a):
		if nu != a[j]:
			dis = abs(nu - a[j])
			if dis % 2 != 0:
				odd += 1
	max.append(odd)
max.sort()
print(max[0])


import math
n = input()
s = input()
s += ' '
crnt = ''
a = []
count = 0
for i in s:
	if i == ' ':
		a += [int(crnt)]
		crnt = ''
		continue
	crnt += i
for i in a:
	if i % 2 == 0:
		f = True
	else:
		f = False
		break
for i in a:
	if i % 2 == 1:
		f = True
	else:
		f = False
		break
if not f:
	c = []
	b = []
	for i in a:
		if i % 2 == 0:
			b += [i]
		else:
			c += [i]
	max_len = min(len(b), len(c))
	print(max_len)
else:
	print(0)


n = int(input())
tmp = input().split()
odd = 0
even = 0
for chip in tmp:
	chip = int(chip)
	if chip % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


import math
n = int(input())
x = 0
s = input()
s = list(map(int, s.split()))
for i in s:
	if i % 2 == 0:
		x += 1
print(min(x, n - x))


n = int(input())
arr = [int(x) for x in input().split()]
z = []
for i in range(n):
	price = 0
	for j in range(n):
		if j == i or arr[j] == arr[i]:
			continue
		x = abs(arr[j] - arr[i])
		if x % 2 == 0:
			continue
		else:
			price += 1
	z.append(price)
print(min(z))


def main():
	input()
	a = [int(i) % 2 for i in input().split(' ')]
	print(min(a.count(0), a.count(1)))
main()


n = int(input())
xs = list(map(int, input().split()))
eves = []
for i in xs:
	if i % 2 == 0:
		eves.append(1)
	else:
		eves.append(0)
odds = eves.count(0)
evens = eves.count(1)
if evens < odds:
	print(evens)
else:
	print(odds)


import math
import os
import random
import re
import sys
n = int(input())
coordinates = list(map(int, input().split()))
if n == 1:
	print(0)
else:
	odd_coordinates = len(list(filter(lambda x: x % 2 != 0, coordinates)))
	even_coordinates = n - odd_coordinates
	if odd_coordinates == 0 or even_coordinates == 0:
		print(0)
	else:
		print(min(even_coordinates, odd_coordinates))


n = int(input())
even = 0
odd = 0
chips = input().split(' ')
for i in chips:
	if int(i) % 2 == 0:
		even = even + 1
	else:
		odd = odd + 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
l = list(map(int, input().split()))
p = list(filter(lambda x: x % 2, l))
print(min(len(p), n - len(p)))


n = input()
nums = input().split()
cnto = 0
for num in nums:
	if int(num) % 2 == 0:
		cnto += 1
print(min(cnto, int(n) - cnto))


length = int(input())
even = 0
odd = 0
for i in [int(x) for x in input().split(' ')]:
	if i % 2:
		odd += 1
	else:
		even += 1
print(min(even, odd))


n = int(input())
(o, e) = (0, 0)
for i in map(int, input().split()):
	if i & 1 > 0:
		o += 1
	else:
		e += 1
print(min(o, e))


n = int(input())
lista = [int(i) for i in input().split()]
pares = 0
impares = 0
for item in lista:
	if item % 2 == 0:
		pares += 1
	else:
		impares += 1
if pares < impares:
	print(pares)
else:
	print(impares)


import sys
n = int(input())
num = list(map(int, sys.stdin.readline().rstrip().split()))
res = 987654321
for i in range(n):
	currmin = 0
	for j in range(n):
		if j == i:
			continue
		if num[i] == num[j]:
			continue
		if num[i] % 2 == num[j] % 2:
			continue
		else:
			currmin += 1
	res = min(res, currmin)
print(res)


n = int(input())
ans = sum([e % 2 for e in list(map(int, input().split()))])
print(min(n - ans, ans))


n = int(input())
x = list(map(int, input().split()))
ans = -1
for i in range(n):
	temp = 0
	for j in range(n):
		if abs(x[i] - x[j]) % 2 == 1:
			temp += 1
	if ans == -1:
		ans = temp
	elif ans > temp:
		ans = temp
print(ans)


N = input()
n = int(N)
p = input().split()
for i in range(len(p)):
	p[i] = int(p[i])
odd = 0
even = 0
for i in range(n):
	if p[i] & 1:
		odd = odd + 1
	else:
		even = even + 1
print(min(odd, even))


n = int(input())
l = [int(i) for i in input().split()]
c = 0
d = 0
for i in l:
	if i % 2 == 0:
		c += 1
	else:
		d += 1
print(min(c, d))


n = int(input())
a = list(map(int, input().split()))
res = 100000000
for i in range(n):
	tmp = 0
	for j in range(n):
		x = a[i] - a[j]
		if x < 0:
			x = x * -1
		if x % 2:
			tmp += 1
	if res > tmp:
		res = tmp
print(res)


a = int(input())
b = list(map(int, input().split()))
even = 0
odd = 0
for i in range(a):
	if b[i] & 1:
		odd += 1
	else:
		even += 1
print(min(even, odd))


(n, k) = (int(input()), sum((x % 2 for x in map(int, input().split()))))
print(min(k, n - k))


def solve(n, x):
	odds = len(list(filter(lambda a: a % 2 == 1, x)))
	evens = n - odds
	if evens < odds:
		return evens
	return odds

def main():
	n = int(input())
	x = list(map(int, input().split()))
	print(solve(n, x))
main()


num = int(input())
a = list(map(int, input().split()))
m = min(a)
count = 0
for i in range(num):
	if (a[i] - m) % 2 == 1:
		count += 1
if count > num - count:
	print(num - count)
else:
	print(count)


import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
c = 0
for a in A:
	if a % 2 == 0:
		c += 1
print(min(c, N - c))


(x, n) = [0, int(input())]
for y in map(int, input().split()):
	x += y & 1
print(min(x, n - x))


n = int(input())
cnt = sum(map(lambda x: int(x) % 2, input().split()))
print(min(cnt, n - cnt))


import math
n = int(input())
arr = list(map(int, input().split()))
odd = list(filter(lambda x: x % 2 == 0, arr))
if len(odd) < n - len(odd):
	print(len(odd))
else:
	print(n - len(odd))


import math
n = int(input())
l = list(map(int, input().split()))
e = [x for x in l if x % 2 == 0]
o = [x for x in l if x % 2 == 1]
if len(e) >= len(o):
	print(len(o))
else:
	print(len(e))


count = int(input())
array = list(map(int, input().split()))
odds = 0
for i in array:
	if i % 2:
		odds += 1
if odds > count / 2:
	print(count - odds)
else:
	print(odds)


import math
from decimal import Decimal
import heapq

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def Factor(n):
	Ans = []
	d = 2
	while d * d <= n:
		if n % d == 0:
			Ans.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		Ans.append(n)
	return Ans
(n, a) = na()
mn = 921213213213123123
for _ in set(a):
	d = _
	tc = 0
	for i in range(n):
		if a[i] == d:
			continue
		s = abs(a[i] - d)
		if s % 2 == 0:
			continue
		else:
			tc += 1
	mn = min(tc, mn)
print(mn)


from sys import stdin
from copy import deepcopy
from collections import deque

class ListNode:

	def __init__(self, x):
		self.val = x
		self.next = None
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
even = 0
for i in range(n):
	if arr[i] % 2 == 0:
		even += 1
if even > n - even:
	print(n - even)
else:
	print(even)


from math import *
from collections import *
from itertools import *
get = lambda : int(input())
getl = lambda : [int(x) for x in input().split()]

def main():
	n = get()
	l = getl()
	o = 0
	e = 0
	for x in l:
		if x % 2 == 1:
			o += 1
		else:
			e += 1
	print(min(o, e))
main()


while True:
	try:
		n = int(input())
		lst = list(map(int, input().split()))
		a = 0
		b = 0
		for i in lst:
			if i % 2 == 0:
				a += 1
			else:
				b += 1
		print(min(a, b))
	except:
		break


z = input
mod = 10 ** 9 + 7
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)
n = int(z())
l = sorted(list(map(int, z().split())))
t = sum(l) // n
ans = []
for i in list(set(l)):
	c = 0
	for j in l:
		x = abs(i - j)
		if x % 2 != 0:
			c += 1
	ans.append(c)
print(min(ans))


n = int(input())
ls = list(map(int, input().split()))
even = sum([1 if x % 2 else 0 for x in ls])
print(min(even, n - even))


n = int(input())
x = input()
x = x.split()
a = 0
no = 0
an = 0
b = 0
while b < n:
	if int(x[b]) % 2 == 1 or int(x[b]) == 1:
		no = no + 1
	b = b + 1
print(min(no, n - no))


t = input()
a = input().split()
b = map(int, a)
list_of_integers = list(b)
list_of_integers.sort()
odd_count = 0
even_count = 0
for i in list_of_integers:
	if i % 2 == 1:
		odd_count += 1
	else:
		even_count += 1
if odd_count > even_count:
	print(even_count)
else:
	print(odd_count)


N = int(input())
s = [int(x) for x in input().split()]
c1 = 0
c2 = 0
for i in range(0, len(s)):
	if s[i] % 2 == 0:
		c2 += 1
	else:
		c1 += 1
print(min(c1, c2))


n = input()
X = list(map(int, input().split()))
x1 = [x for x in X if x % 2]
x2 = [x for x in X if not x % 2]
print(min(len(x1), len(x2)))


N = int(input())
a = input().split()
for i in range(N):
	a[i] = int(a[i])
l1 = 0
l2 = 0
for i in a:
	if i % 2 == 0:
		l1 += 1
	else:
		l2 += 1
print(min(l1, l2))


n = int(input())
l = list(map(int, input().split()))
left = [[0, 0]]
right = [[0, 0]]
final = []
i = 1
while i < n:
	if (l[i] - l[i - 1]) % 2 == 0:
		left.append([left[i - 1][0], left[i - 1][1] + 1])
	else:
		left.append([left[i - 1][1] + 1, left[i - 1][0]])
	i += 1
j = 0
i = n - 2
while i >= 0:
	if (l[i] - l[i + 1]) % 2 == 0:
		right = [[right[0][0], right[0][1] + 1]] + right
	else:
		right = [[right[0][1] + 1, right[0][0]]] + right
	i -= 1
	j += 1
ans = n
for i in range(n):
	if left[i][0] + right[i][0] < ans:
		ans = left[i][0] + right[i][0]
print(ans)


n = int(input())
x = [int(i) for i in input().split()]
r = [i % 2 for i in x]
odd_count = r.count(1)
even_count = r.count(0)
print(min(odd_count, even_count))


def chips(arr):
	x = list(map(lambda x: x % 2 == 0, arr))
	if x.count(True) == 0 or x.count(False) == 0:
		return 0
	ev = x.count(True)
	od = x.count(False)
	if max(ev, od) == ev:
		return od
	if max(od, ev) == od:
		return ev
n = int(input())
arr = list(map(int, input().rstrip().split()))
print(chips(arr))


n = int(input())
l = [int(x) for x in input().split()]
count1 = 0
count2 = 0
for e in l:
	if e % 2 == 0:
		count1 += 1
	else:
		count2 += 1
print(min(count1, count2))


import sys
import math
n = int(input())
ecount = 0
ocount = 0
mincount = 0
dic = {}
lis = list(map(int, input().split()))
for i in lis:
	if i not in dic:
		dic[i] = 1
	else:
		dic[i] += 1
if len(dic) == 1:
	mincount = 0
else:
	for j in dic:
		if j % 2 == 0:
			ecount += 1 * dic[j]
		else:
			ocount += 1 * dic[j]
	mincount = min(ecount, ocount)
print(mincount)


n = int(input())
n_arr = list(map(int, input().split()))
dict_n = {}
for i in n_arr:
	if i not in dict_n:
		dict_n[i] = 1
	else:
		dict_n[i] += 1
even_sum = 0
odd_sum = 0
for (key, value) in dict_n.items():
	if key % 2 == 0:
		even_sum += value
	else:
		odd_sum += value
print(min(even_sum, odd_sum))


n = int(input())
arr = list(map(int, input().split()))
count = 0
for e in arr:
	if e % 2 == 0:
		count += 1
print(min(count, n - count))


a = int(input())
b = list(map(int, input().strip().split()))
(c, d) = (0, 0)
for i in range(a):
	if b[i] % 2 == 0:
		c = c + 1
	else:
		d = d + 1
print(min(c, d))


(n, inp) = (int(input()), input().split())
print(min(sum(map(lambda x: x % 2, [int(i) for i in inp])), sum(map(lambda x: (x - 1) % 2, [int(i) for i in inp]))))


import statistics
from statistics import mode

def ChipsMoving(l, n):
	odd = 0
	even = 0
	for x in range(0, n):
		if l[x] % 2 == 0:
			even += 1
		else:
			odd += 1
	print(min(odd, even))
n = int(input())
ChipsMoving(list(map(int, input().rstrip().split())), n)


n = int(input())
even = 0
data = [int(i) for i in input().split()]
for i in data:
	even += 1 if i % 2 == 0 else 0
print(min(n - even, even))


n = int(input())
a = list(map(int, input().split()))
k = 0
ch = 0
for i in a:
	if i % 2 == 0:
		ch += 1
print(min(ch, len(a) - ch))


n = int(input())
(e, l) = (0, list(map(int, input().split())))
for x in l:
	if x % 2 == 0:
		e += 1
print(min(e, n - e))


upper = 10 ** 12
min_cost = upper
n = int(input())
chips = list(map(int, input().split()))
chips.sort()
for i in range(n):
	base = chips[i]
	c = 0
	for j in range(n):
		d = abs(base - chips[j])
		c += d % 2
	min_cost = min(min_cost, c)
print(min_cost)


n = int(input())
odd = sum((e & 1 for e in map(int, input().split())))
print(min(odd, n - odd))


n = int(input())
inp = input()
abc = inp.split()
odd = 0
even = 0
for i in range(n):
	if int(abc[i]) % 2 == 0:
		even = even + 1
	else:
		odd = odd + 1
out = min(odd, even)
print(out)


import math
y = int(input())
row = input().split(' ')
pares = 0
impares = 0
for x in range(y):
	if int(row[x]) % 2 == 0:
		pares = pares + 1
	else:
		impares = impares + 1
if pares >= impares:
	print(impares)
else:
	print(pares)


n = int(input())
x = list(map(int, input().split()))
li = []
c = 0
r = 10 ** 9 + 7
for i in range(n):
	c = 0
	for j in range(n):
		c += abs(x[i] - x[j]) % 2
	r = min(r, c)
print(r)


numofnum = input()
numbers = input()
numbers = numbers.split()
numofevens = 0
numofodds = 0
for number in numbers:
	number = int(number)
	if number % 2 == 0:
		numofevens = numofevens + 1
	else:
		numofodds = numofodds + 1
GT = 0
if numofevens >= numofodds:
	print(numofodds)
else:
	print(numofevens)


import math
n = int(input())
x = list(map(int, input().split()))
ans = math.inf
for i in range(n):
	cnt = 0
	for j in range(n):
		if i == j:
			continue
		cnt += 1 if (x[i] - x[j]) % 2 != 0 else 0
	ans = min(ans, cnt)
print(ans)


input()
a = [int(i) for i in input().split()]
odds = 0
evens = 0
for i in a:
	if i % 2:
		odds += 1
	else:
		evens += 1
print(odds) if odds < evens else print(evens)


n = int(input())
a = [int(x) for x in input().split()]
if n > 1:
	ans = float('inf')
	for i in range(n):
		coins = 0
		for j in range(n):
			if a[j] != a[i]:
				cond1 = a[j] % 2 == 0 and a[i] % 2 == 1
				cond2 = a[j] % 2 == 1 and a[i] % 2 == 0
				if cond1 or cond2:
					coins += 1
		ans = min(ans, coins)
	print(ans)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
cnt_odd = 0
cnt_even = 0
for x in a:
	if x % 2 == 0:
		cnt_even += 1
	else:
		cnt_odd += 1
print(min(cnt_odd, cnt_even))


n = int(input())
ans = 9999999999999999999999999999999999999999999999999
a = list(map(int, input().split()))
for i in range(n):
	x = a[i]
	cnt = 0
	for j in range(n):
		if x & 1:
			if i is not j:
				if a[j] & 1 == 0:
					cnt += 1
		elif i is not j:
			if a[j] & 1:
				cnt += 1
	ans = min(ans, cnt)
print(ans)


n = int(input())
seq = [int(x) for x in input().split()]
count = 0
for ele in seq:
	if ele % 2 == 0:
		count += 1
print(min(count, n - count))


n = int(input())
l = sorted(list(map(int, input().split())))
o = 0
e = 0
for i in l:
	if i % 2 == 0:
		e = i
for i in l:
	if i % 2 == 1:
		o = i
(c, k) = (0, 0)
if o == 0 or e == 0:
	mx = max(o, e)
	for i in l:
		if abs(i - mx) % 2 == 0:
			c += 0
		else:
			c += 1
	print(c)
else:
	for i in l:
		if abs(o - i) % 2 == 0:
			c += 0
		else:
			c += 1
	for i in l:
		if abs(e - i) % 2 == 0:
			k += 0
		else:
			k += 1
	print(min(c, k))


n = int(input())
lis = list(map(int, input().split()))
ans = 10000000000
c = 0
even = 0
odd = 0
for i in lis:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(even, odd))


n = int(input())
x = [int(s) for s in input().split(' ')]
y = sum([z % 2 for z in x])
ans = min(y, n - y)
print(ans)


n = int(input())
s = list(map(int, input().split()))
r = sum((y % 2 != 0 for y in s))
r2 = sum((y % 2 == 0 for y in s))
print(min(r, r2))


import math
import random
import sys
n = int(input())
x = 0
a = list(map(int, input().split()))
for i in range(0, n):
	if a[i] % 2 == 0:
		x += 1
print(min(x, n - x))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst = get_int_list()
even = odd = 0
for i in range(n):
	if lst[i] % 2 == 0:
		even += 1
	else:
		odd += 1
if odd < even:
	print(odd)
else:
	print(even)


def mp():
	return map(int, input().split())
n = int(input())
a = list(mp())
f = s = 0
for i in a:
	if i % 2:
		f += 1
	else:
		s += 1
print(min(f, s))


N = int(input())
m = sum((int(i) % 2 for i in input().split()))
print(min(m, N - m))


import math
n = int(input())
x = input() + ' '
c = ''
l = []
lmax = []
for a in x:
	if a != ' ':
		c += a
	else:
		l.append(c)
		c = ''
for a in range(len(l)):
	l[a] = int(l[a])

def cord(a):
	x = l[a]
	s = 0
	for b in range(len(l)):
		if b != a:
			if math.fabs(l[b] - l[a]) % 2 == 1:
				s += 1
	lmax.append(s)
for a in range(len(l)):
	cord(a)
lmax.sort()
print(lmax[0])


n = int(input())
array = list(map(int, input().split()))
for i in range(n):
	array[i] = array[i] % 2
a = array.count(0)
b = array.count(1)
print(min(a, b))


n = int(input())
cnto = 0
inp = list(map(int, input().split()))
for i in range(n):
	if inp[i] % 2 == 0:
		cnto += 1
print(min(cnto, n - cnto))


n = int(input())
numeros = input().split()
pares = 0
for i in numeros:
	if int(i) % 2 == 0:
		pares += 1
if pares > n - pares:
	print(n - pares)
else:
	print(pares)


n = int(input())
l = list(map(int, input().split()))
count = 0
count1 = 0
for a in l:
	if a % 2 == 0:
		count += 1
	else:
		count1 += 1
print(min(count, count1))


N = int(input())
a = list(map(int, input().split()))
res = 10000
for i in range(N):
	cost = 0
	for j in range(N):
		if (a[i] - a[j]) % 2:
			cost += 1
	res = min(res, cost)
print(res)


n = int(input())
arr = list(map(int, input().split()))
res = 0
l = []
for i in range(n):
	if arr[i] % 2 != 0:
		l.append(arr[i])
print(min(len(l), n - len(l)))


n = int(input())
S = [int(i) for i in input().split()]
nch = 0
for i in S:
	if i % 2 == 1:
		nch += 1
if nch > n - nch:
	print(n - nch)
else:
	print(nch)


n = int(input())
arr = list(map(int, input().split()))
a = [0, 0]
for i in range(n):
	a[arr[i] % 2] += 1
print(min(a[0], a[1]))


n = int(input())
v = [i for i in input().split() if int(i) % 2 == 0]
print(min(len(v), n - len(v)))


n = int(input())
a = [int(x) for x in input().split()]
dem = 0
for i in a:
	if i % 2 == 0:
		dem += 1
if dem < n - dem:
	print(dem)
else:
	print(n - dem)


n = int(input())

def m(x):
	return x % 2
a = list(map(int, input().split(' ')))
a = list(map(m, a))
print(min(a.count(0), a.count(1)))


N = int(input())
a = input().split()
(even, odd) = (0, 0)
for i in range(N):
	a[i] = int(a[i])
	if a[i] % 2:
		odd += 1
	else:
		even += 1
print(min(odd, even))


import math
n = int(input())
arr_list = input().split()
array = []
for item in arr_list:
	array.append(int(item))
min = 9999999999999999999
for i in array:
	count = 0
	for j in array:
		if abs(i - j) % 2 != 0:
			count += 1
	if count < min:
		min = count
print(min)


n = int(input())
chips = map(int, input().split())
even = 0
odd = 0
for chip in chips:
	if chip % 2 == 0:
		even += 1
	else:
		odd += 1
print(even) if even < odd else print(odd)


n = int(input())
arr = map(int, input().split())
even = 0
odd = 0
for a in arr:
	if a & 1 == 0:
		even += 1
	else:
		odd += 1
if even > odd:
	print(odd)
else:
	print(even)


n = int(input())
X = list(map(int, input().split()))
diff = 0
ans = 0
L = [0 for i in range(n)]
for i in range(n):
	for j in range(n):
		if i == j:
			continue
		if abs(X[i] - X[j]) % 2 == 0:
			L[i] += 1
a = max(L)
print(n - a - 1)


n = int(input())
l = list(map(int, input().split()))
cnt_e = cnt_o = 0
for i in range(len(l)):
	if l[i] % 2 == 0:
		cnt_e += 1
	else:
		cnt_o += 1
if cnt_e == cnt_o:
	print(cnt_e)
else:
	print(min(cnt_e, cnt_o))


n = int(input())
A = [int(i) for i in input().split()]
odd = len([i for i in A if i % 2])
even = len([i for i in A if i % 2 == 0])
print(min(odd, even))


n = int(input())
chip = input().split(' ')
pair = 0
odd = 0
for i in range(n):
	if int(chip[i]) % 2 == 0:
		pair += 1
	else:
		odd += 1
if pair <= odd:
	print(pair)
else:
	print(odd)


n = int(input())
a = [*map(int, input().split())]
odd = len([*filter(lambda x: x % 2 == 1, a)])
even = n - odd
print(even) if odd > even else print(odd)


n = int(input())
li = list(map(int, input().split(' ')))
fans = 0
b = True
for i in range(len(li)):
	ans = 0
	for j in range(len(li)):
		if not abs(li[i] - li[j]) % 2 == 0:
			ans += 1
	if b == True:
		fans = ans
		b = False
	if ans < fans:
		fans = ans
print(fans)


import math
n = int(input())
c = map(int, input().split())
paritate = [0, 0]
for i in c:
	paritate[i % 2] += 1
if paritate[0] == 0 or paritate[1] == 0:
	print(0)
elif paritate[0] > paritate[1]:
	print(paritate[1])
else:
	print(paritate[0])


n = int(input())
mas = list(map(int, input().split()))
chet = nechet = 0
for el in mas:
	if el % 2 == 0:
		chet += 1
	else:
		nechet += 1
if chet > nechet:
	print(nechet)
else:
	print(chet)


n = int(input())
pra = list(map(int, input().split()))
ch = 0
for i in range(n):
	if pra[i] % 2 == 0:
		ch += 1
print(min(n - ch, ch))


import sys
n = int(input())
x = list(map(int, input().split()))
m = sys.maxsize
for i in range(n):
	c = 0
	for j in range(n):
		if abs(x[i] - x[j]) % 2 == 1:
			c += 1
	if c < m:
		m = c
print(m)


n = int(input())
l = input()
l1 = l.split()
ll = len(l1)
for i in range(ll):
	l1[i] = int(l1[i])
p = 0
n = 0
for i in range(ll):
	if l1[i] % 2 == 0:
		p += 1
	else:
		n += 1
if p > n:
	print(n)
elif n > p:
	print(p)
else:
	print(n)


qtos = int(input())
vetor = input().split()
par = 0
impar = 0
for i in range(qtos):
	if int(vetor[i]) % 2 == 0:
		par += 1
	else:
		impar += 1
if par < impar:
	print(par)
else:
	print(impar)


n = int(input())
arr = [int(x) for x in input().split(' ')]
one = two = 0
if n > 1:
	for var in arr:
		if abs(var) % 2 == 0:
			two += 1
		else:
			one += 1
	print(min(one, two))
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
m = 0
n = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		m += 1
	else:
		n += 1
print(min(m, n))


def get_ans(array, n):
	even_counter = 0
	odd_counter = 0
	for i in array:
		if i % 2 == 1:
			odd_counter += 1
		else:
			even_counter += 1
	return min(even_counter, odd_counter)
n = int(input())
array = list(map(int, input().strip().split()))
print(get_ans(array, n))


def moves(A):
	even = 0
	for pos in A:
		if pos % 2 == 0:
			even += 1
	odd = len(A) - even
	return min(even, odd)
assert moves([1, 2, 3]) == 1
assert moves([2, 2, 2, 3, 3]) == 2
n = int(input())
A = list(map(int, input().split()))
ans = moves(A)
print(ans)


n = int(input())
a = [int(i) for i in input().split()]
even = 0
for i in range(n):
	if a[i] % 2 == 0:
		even += 1
print(min(even, n - even))


from sys import stdin, stdout
input = stdin.readline
n = map(int, input().split())
x = [int(i) for i in input().split()]
res = 1000 * 1000 * 1000 * 1000
(a, b) = (0, 0)
for i in x:
	a += i % 2 == 0
	b += i % 2 == 1
print(min(a, b))


from sys import stdin, stdout
from collections import defaultdict
from collections import deque
import math
import copy
N = int(input())
arr = [int(x) for x in stdin.readline().split()]
arr.sort()
res = 999999999999
for i in range(N):
	center = arr[i]
	cost = 0
	for j in range(N):
		num = abs(arr[j] - center)
		if num % 2 == 1:
			cost += 1
	res = min(res, cost)
print(res)


n = int(input())
l = [int(i) for i in input().split()]
o = 10 ** 9
for i in range(0, len(l)):
	sum = 0
	sums = 0
	a = 0
	b = len(l) - 1
	while a < i:
		if abs(l[a] - l[i]) % 2 != 0:
			sum = sum + 1
			a = a + 1
		else:
			a = a + 1
	while b > i:
		if abs(l[b] - l[i]) % 2 != 0:
			sums = sums + 1
			b = b - 1
		else:
			b = b - 1
	if sum + sums < o:
		o = sum + sums
print(o)


n = int(input())
a = [int(x) for x in input().split()]
noch = 0
for i in a:
	noch += i % 2
if noch < n - noch:
	print(noch)
else:
	print(n - noch)


a = int(input())
chips = list(map(int, input().split()))
cnt = 0
cnt1 = 0
for value in chips:
	if value % 2:
		cnt -= -1
	else:
		cnt1 -= -1
print(min(cnt, cnt1))


n = int(input())
stones = [int(x) for x in input().split()]
mex = max(stones)
meen = min(stones)
mid1 = (mex + meen) // 2
mid2 = (mex + meen) // 2 + 1
count1 = 0
count2 = 0
for i in range(len(stones)):
	if abs(stones[i] - mid1) % 2 != 0:
		count1 += 1
for i in range(len(stones)):
	if abs(stones[i] - mid2) % 2 != 0:
		count2 += 1
print(min(count1, count2))


n = int(input())
x = [*map(int, input().split())]
ans = 1000000000.0
for i in x:
	res = 0
	for j in x:
		res += (j - i) % 2
	ans = min(res, ans)
print(ans)


import sys, math
input = sys.stdin.readline
n = int(input())
q = sum((i & 1 for i in map(int, input().split())))
print(min(q, n - q))


n = int(input())
(oddcount, evencount) = (0, 0)
x = map(int, input().split(' '))
for n in x:
	if n % 2 == 0:
		evencount += 1
	else:
		oddcount += 1
print(min(oddcount, evencount))


a = int(input())
m = list(map(int, input().split(' ')))
out = 0
out2 = 0
for x in m:
	if x % 2 != 0:
		out += 1
	else:
		out2 += 1
if out2 > out:
	print(out)
if out >= out2:
	print(out2)


n = int(input())
l = input()
ls = l.split(' ')
for i in range(0, len(ls)):
	ls[i] = int(ls[i])
odd = 0
m = min(ls)
for i in ls:
	if i % 2 != 0:
		odd += 1
print(min(odd, n - odd))


from sys import stdin, stdout
n = stdin.readline()
inp_arr = [int(x) for x in stdin.readline().split()]
odd = 0
even = 0
for i in inp_arr:
	if i % 2 == 0:
		even += 1
	else:
		odd += 1
ans = min(odd, even)
stdout.write(str(ans))


N = int(input())
kiek = 0
for x in input().split():
	kiek += int(x) & 1
print(min(kiek, N - kiek))


n = int(input())
even_num = 0
temp = input()
val = temp.split(' ')
for pos in val:
	if int(pos) & 1 == 0:
		even_num += 1
print(min(even_num, n - even_num))


n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = 10 ** 6
for i in range(n):
	coins = 0
	j = 0
	while j < n:
		if j != i:
			if arr[i] % 2 != arr[j] % 2:
				coins += 1
		j += 1
	ans = min(ans, coins)
print(ans)


n = int(input())
x = [int(i) for i in input().split()]
chet = 0
nechet = 0
for i in range(n):
	if x[i] % 2 == 0:
		chet += 1
	elif x[i] % 2 != 0:
		nechet += 1
if nechet >= chet and chet != 0:
	print(chet)
elif nechet <= chet and nechet != 0:
	print(nechet)
else:
	print(0)


n = int(input())
arr = list(map(int, input().split()))
cords = {}
for num in arr:
	try:
		cords[num] += 1
	except Exception:
		cords[num] = 1
cost = 10000000000000000000000000
keys = list(cords.keys())
for i in range(len(keys)):
	c_cost = 0
	for j in range(len(keys)):
		if i != j:
			current_cord = keys[i]
			check_cords = keys[j]
			if abs(abs(current_cord) - abs(check_cords)) % 2 != 0:
				c_cost += cords[check_cords]
	if c_cost < cost:
		cost = c_cost
print(cost)


N = int(input())
chips = [int(x) for x in input().split(' ')]
odds = sum([i % 2 for i in chips])
evens = sum([i % 2 == 0 for i in chips])
if odds >= evens:
	print(evens)
else:
	print(odds)


from sys import stdin
n = int(stdin.readline().strip())
s = list(map(int, stdin.readline().strip().split()))
ans = 10000
for i in range(n):
	aux = 0
	for j in range(n):
		if j == i:
			continue
		if abs(s[i] - s[j]) % 2 != 0:
			aux += 1
	ans = min(aux, ans)
print(ans)


input()
l = list(map(int, input().split()))
print(min(sum((x % 2 for x in l)), sum(((x + 1) % 2 for x in l))))


n = int(input())
loc = input().split()
loc = [int(i) for i in loc]
o = 0
e = 0
for i in loc:
	if i % 2 == 0:
		e += 1
	if i % 2 == 1:
		o += 1
if e > o:
	print(o)
else:
	print(e)


n = int(input())
mylist = list(map(int, input().split()))
evenCount = 0
oddCount = 0
for i in range(len(mylist)):
	if mylist[i] % 2 == 0:
		evenCount += 1
	else:
		oddCount += 1
print(min(evenCount, oddCount))


n = int(input())
a = list(map(int, input().split()))
a.sort()
e = 0
o = 0
k = 0
for i in range(n):
	if a[i] % 2 == 0:
		e += 1
if e > n - e:
	k = k + n - e
else:
	k = k + e
print(k)


int(input())
x = [*map(int, input().split())]
print(min(sum((1 - i % 2 for i in x)), sum((i % 2 for i in x))))


n = int(input())
li = [int(x) for x in input().split()]
ev = 0
od = 0
for i in li:
	if abs(i) % 2 == 0:
		ev += 1
	else:
		od += 1
print(min(ev, od))


def inp():
	return int(input())

def ln():
	return [int(x) for x in input().split()]
n = inp()
x = ln()
mn = 10 ** 20
for i in range(n):
	cst = 0
	for c in x:
		cst += 1 if abs(c - x[i]) % 2 == 1 else 0
	mn = min(mn, cst)
print(mn)


n = int(input())
ans = sum((int(x) % 2 for x in input().split()))
print(min(ans, n - ans))


import sys
from collections import *
from math import *
import re

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	c = 0
	for i in range(2, n):
		if prime[i]:
			c += 1
	return c

def iseven(n):
	return [False, True][0 if n % 2 else 1]

def inp_arr():
	return list(map(int, input().split()))

def inp():
	return map(int, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
max_int = sys.maxsize
mod = 10 ** 9 + 7
n = int(input())
arr = inp_arr()
print(min(sum((i % 2 for i in arr)), n - sum((i % 2 for i in arr))))


N = int(input())
(*X,) = map(int, input().split())
cnt = 0
for x in X:
	cnt += x & 1
print(min(cnt, N - cnt))


def arr_inp():
	return [int(x) for x in input().split()]
(n, a) = (int(input()), arr_inp())
(odd, even) = (0, 0)
for i in a:
	if i % 2:
		odd += 1
	else:
		even += 1
print(min(even, odd))


n = int(input())
ln = [int(i) for i in input().split(' ')]
m = 0
for i in ln:
	if i % 2 == 0:
		m += 1
print(min(m, n - m))


n = int(input())
c = list(map(int, input().split()))
p = 0
np = 0
for num in c:
	if num % 2 == 0:
		p += 1
	else:
		np += 1
print(min(p, np))


n = int(input())
A = list(map(int, input().split()))
for i in range(n):
	A[i] %= 2
print(min(n - A.count(0), A.count(0)))


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
from fractions import Fraction

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)
n = ii()
l = li()
out = []
for i in range(n):
	c = 0
	for j in range(n):
		x = abs(l[i] - l[j])
		if x % 2 == 1:
			c += 1
	out.append(c)
print(min(out))


n = int(input())
a = [int(i) for i in input().split()]
(ans1, ans) = (0, 9999999999999999999999)
for m in a:
	ans1 = 0
	for i in range(len(a)):
		if m % 2 == 0 and a[i] % 2 == 0:
			continue
		elif m % 2 != 0 and a[i] % 2 != 0:
			continue
		else:
			ans1 += 1
	ans = min(ans, ans1)
print(ans)


n = int(input())
s = list(map(int, input().split()))
ans = 9999999999999999
for i in range(n):
	cnt = 0
	for j in range(n):
		cnt += abs(s[i] - s[j]) % 2
	ans = min(ans, cnt)
print(ans)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
minn = 99999999999999
for final in range(N):
	curr = 0
	for j in range(N):
		if final != j:
			if abs(l[final] - l[j]) & 1 == 1:
				curr += 1
	minn = min(minn, curr)
print(minn)


def rint():
	return int(input())

def rints():
	return list(map(int, input().split()))
n = rint()
x = rints()
mc = 10000
for i in range(n):
	cost = 0
	for j in range(n):
		cost += abs(x[i] - x[j]) % 2
	mc = min(mc, cost)
print(mc)


b = int(input())
a = list(map(int, input().split()))
odd = 0
even = 0
for k in a:
	if k % 2 == 0:
		even += 1
	else:
		odd += 1
if odd >= even:
	print(even)
else:
	print(odd)


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cntr = Counter(a)
(k1, k2) = (0, 0)
for k in cntr.keys():
	if k & 1:
		k1 += cntr[k]
	else:
		k2 += cntr[k]
print(min(k1, k2))