On a random day, Neko found $n$ treasure chests and $m$ keys. The $i$-th chest has an integer $a_i$ written on it and the $j$-th key has an integer $b_j$ on it. Neko knows those chests contain the powerful mysterious green Grapes, thus Neko wants to open as many treasure chests as possible.

The $j$-th key can be used to unlock the $i$-th chest if and only if the sum of the key number and the chest number is an odd number. Formally, $a_i + b_j \equiv 1 \pmod{2}$. One key can be used to open at most one chest, and one chest can be opened at most once.

Find the maximum number of chests Neko can open.


-----Input-----

The first line contains integers $n$ and $m$ ($1 \leq n, m \leq 10^5$) — the number of chests and the number of keys.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 10^9$) — the numbers written on the treasure chests.

The third line contains $m$ integers $b_1, b_2, \ldots, b_m$ ($1 \leq b_i \leq 10^9$) — the numbers written on the keys.


-----Output-----

Print the maximum number of chests you can open.


-----Examples-----
Input
5 4
9 14 6 2 11
8 4 7 20

Output
3
Input
5 1
2 4 6 8 10
5

Output
1
Input
1 4
10
20 30 40 50

Output
0


-----Note-----

In the first example, one possible way to unlock $3$ chests is as follows:

  Use first key to unlock the fifth chest,  Use third key to unlock the second chest,  Use fourth key to unlock the first chest. 

In the second example, you can use the only key to unlock any single chest (note that one key can't be used twice).

In the third example, no key can unlock the given chest.

Difficulty: EASY

Solutions:
(n, m) = map(int, input().split())
boxes = [int(i) for i in input().split()]
keys = [int(i) for i in input().split()]
chetBoxes = list(filter(lambda x: x % 2 == 0, boxes))
nechetBoxes = list(filter(lambda x: x % 2 != 0, boxes))
chetKeys = list(filter(lambda x: x % 2 == 0, keys))
nechetKeys = list(filter(lambda x: x % 2 != 0, keys))
print(min(len(nechetBoxes), len(chetKeys)) + min(len(chetBoxes), len(nechetKeys)))


def read_ints():
	return list(map(int, input().split()))
(n, m) = read_ints()
a = read_ints()
b = read_ints()
nech1 = 0
ch1 = 0
nech2 = 0
ch2 = 0
for x in a:
	if x % 2 == 0:
		ch1 += 1
nech1 = n - ch1
for x in b:
	if x % 2 == 0:
		ch2 += 1
nech2 = m - ch2
ans = min(ch1, nech2) + min(ch2, nech1)
print(ans)


(n, m) = list(map(int, input().split()))
a = sum([1 if int(t) % 2 else 0 for t in input().split()])
b = sum([1 if int(t) % 2 else 0 for t in input().split()])
print(min(a, m - b) + min(n - a, b))


tt = input()
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
o = 0
e = 0
for i in l1:
	if i % 2 == 0:
		e += 1
for j in l2:
	if j % 2 != 0:
		o += 1
print(min(e, o) + min(len(l1) - e, len(l2) - o))


(n, m) = input().split()
m = int(m)
n = int(n)
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))
l = []
k = []
p = []
q = []
for i in ln:
	if i % 2 == 0:
		l.append(i)
	else:
		k.append(i)
for i in lm:
	if i % 2 == 0:
		p.append(i)
	else:
		q.append(i)
ans = min(len(q), len(l)) + min(len(k), len(p))
print(ans)


i = lambda : map(int, input().split())
(n, m) = i()
keys = list(map(lambda x: int(x) % 2, input().split()))
locks = list(map(lambda x: int(x) % 2, input().split()))
(k, l) = (sum(keys), sum(locks))
print(min(k, m - l) + min(l, n - k))


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
for i in a:
	if i % 2 not in d:
		d[i % 2] = 1
	else:
		d[i % 2] += 1
s = {}
for i in b:
	if i % 2 not in s:
		s[i % 2] = 1
	else:
		s[i % 2] += 1
m = 0
if 1 in d and 0 in s:
	m = min(d[1], s[0])
w = 0
if 0 in d and 1 in s:
	w = min(d[0], s[1])
print(w + m)


def main():
	(n, m) = [int(v) for v in input().split()]
	vals1 = [int(v) for v in input().split()]
	vals2 = [int(v) for v in input().split()]
	x1 = len([v for v in vals1 if v % 2 == 0])
	x2 = len([v for v in vals1 if v % 2 != 0])
	y1 = len([v for v in vals2 if v % 2 == 0])
	y2 = len([v for v in vals2 if v % 2 != 0])
	print(min(x1, y2) + min(x2, y1))
main()


nm = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
evenA = 0
oddA = 0
evenB = 0
oddB = 0
for k in range(nm[0]):
	if a[k] % 2 == 1:
		oddA += 1
	else:
		evenA += 1
for k in range(nm[1]):
	if b[k] % 2 == 1:
		oddB += 1
	else:
		evenB += 1
print(min(evenA, oddB) + min(evenB, oddA))


def mp():
	return map(int, input().split())
(n, m) = mp()
a = list(mp())
b = list(mp())
n1 = n2 = c1 = c2 = 0
for i in a:
	if i % 2 == 0:
		c1 += 1
	else:
		n1 += 1
for i in b:
	if i % 2 == 0:
		c2 += 1
	else:
		n2 += 1
print(min(c1, n2) + min(c2, n1))


def openedCount(chests, keys):
	oddChest = 0
	evenChest = 0
	oddKey = 0
	evenKey = 0
	for chest in chests:
		if chest % 2 != 0:
			oddChest += 1
		else:
			evenChest += 1
	for key in keys:
		if key % 2 != 0:
			oddKey += 1
		else:
			evenKey += 1
	return min(oddKey, evenChest) + min(evenKey, oddChest)
(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
print(openedCount(chests, keys))


(T, K) = map(int, input().split())
treat = list(map(int, input().split()))
key = list(map(int, input().split()))
treat_even = list(filter(lambda x: x % 2 == 0, treat))
treat_odd = list(filter(lambda x: x % 2 != 0, treat))
key_even = list(filter(lambda x: x % 2 == 0, key))
key_odd = list(filter(lambda x: x % 2 != 0, key))
print(min(len(treat_even), len(key_odd)) + min(len(treat_odd), len(key_even)))


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


(n, m) = (int(s) for s in input().split())
key = list(map(int, input().split()))
chest = list(map(int, input().split()))
key_odd = 0
chest_odd = 0
for x in key:
	if x % 2 == 0:
		key_odd += 1
for x in chest:
	if x % 2 == 0:
		chest_odd += 1
print(min(key_odd, len(chest) - chest_odd) + min(chest_odd, len(key) - key_odd))

def dfs(i, j):
	if j == len(chest) or i == len(key):
		return 0
	if (key[i] + chest[j]) % 2 == 1:
		return max(1 + dfs(i + 1, j + 1), max(dfs(i + 1, j), dfs(i, j + 1)))
	else:
		return max(dfs(i + 1, j), dfs(i, j + 1))


no = input()
n = input().split()
m = input().split()
n_ev = 0
n_od = 0
m_ev = 0
m_od = 0
for i in range(len(n)):
	if int(n[i]) % 2 == 0:
		n_ev = n_ev + 1
	else:
		n_od = n_od + 1
for i in range(len(m)):
	if int(m[i]) % 2 == 0:
		m_ev = m_ev + 1
	else:
		m_od = m_od + 1
s1 = 0
s2 = 0
if n_od <= m_ev:
	s1 = n_od
else:
	s1 = m_ev
if m_od <= n_ev:
	s2 = m_od
else:
	s2 = n_ev
print(s1 + s2)


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
(n, m) = mi()
(a, b) = (sum((x % 2 for x in li())) for _ in [0, 1])
print(min(a, m - b) + min(b, n - a))


(n, m) = map(int, input().split())
numn = [int(x) for x in input().split()]
numm = [int(x) for x in input().split()]
for i in range(0, n):
	numn[i] = numn[i] % 2
for i in range(0, m):
	numm[i] = numm[i] % 2
a = numn.count(0)
b = numn.count(1)
c = numm.count(0)
d = numm.count(1)
print(min(a, d) + min(b, c))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = a
b1 = b
a = list(filter(lambda x: x % 2 == 0, a))
a1 = list(filter(lambda x: x % 2 == 1, a1))
b = list(filter(lambda x: x % 2 == 0, b))
b1 = list(filter(lambda x: x % 2 == 1, b1))
print(int(min(len(a), len(b1)) + min(len(a1), len(b))))


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math
import heapq

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

def stringListIn():
	return [x for x in stdin.readline().split()]

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

def stringIn():
	return stdin.readline().strip()
(n, m) = listIn()
a = listIn()
b = listIn()
(oda, odb) = (0, 0)
(eva, evb) = (0, 0)
for i in range(n):
	if a[i] % 2 == 0:
		eva += 1
	else:
		oda += 1
for i in range(m):
	if b[i] % 2 == 0:
		evb += 1
	else:
		odb += 1
print(min(eva, odb) + min(evb, oda))


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
f = 0
f1 = 0
f2 = 0
f3 = 0
for i in range(a):
	if l[i] % 2:
		f1 += 1
	else:
		f += 1
for j in range(b):
	if l1[j] % 2:
		f3 += 1
	else:
		f2 += 1
print(min(f, f3) + min(f2, f1))


import collections
(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans1 = []
ans2 = []
for i in range(0, n):
	if a[i] % 2 != 0:
		ans1.append(1)
	else:
		ans1.append(0)
for i in range(0, k):
	if b[i] % 2 != 0:
		ans2.append(1)
	else:
		ans2.append(0)
ans1.sort()
ans2 = sorted(ans2, reverse=True)
anf = 0
d1 = collections.Counter(ans1)
d2 = collections.Counter(ans2)
anf += min(d1[1], d2[0])
anf += min(d1[0], d2[1])
print(anf)


from collections import Counter
(a, b) = list(map(int, input().strip().split()))
x = Counter(map(lambda x: int(x) % 2 == 0, input().strip().split()))
y = Counter(map(lambda x: int(x) % 2 == 0, input().strip().split()))
print(min(x[True], y[False]) + min(x[False], y[True]))


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
x1 = 0
x2 = 0
y1 = 0
y2 = 0
for item in l1:
	if item % 2 == 0:
		x1 += 1
	else:
		x2 += 1
for item in l2:
	if item % 2 == 0:
		y1 += 1
	else:
		y2 += 1
print(min(x2, y1) + min(x1, y2))


(n, m) = map(int, input().split())
n_ch = 0
n_nch = 0
m_ch = 0
m_nch = 0
for inp in list(map(int, input().split())):
	if inp % 2 == 0:
		n_ch += 1
	else:
		n_nch += 1
for inp in list(map(int, input().split())):
	if inp % 2 == 0:
		m_ch += 1
	else:
		m_nch += 1
print(min(n_ch, m_nch) + min(n_nch, m_ch))


(n, m) = map(int, input().split())
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))

def nOdd(l):
	e = 0
	for item in l:
		if item % 2 == 1:
			e += 1
	return e
a1 = nOdd(ln)
b1 = nOdd(lm)
a2 = n - a1
b2 = m - b1
c = min(a1, b2) + min(a2, b1)
print(c)


def max1(a, b):
	if a > b:
		return b
	else:
		return a
(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
e1 = list(filter(lambda x: x % 2 != 0, a))
o1 = list(filter(lambda x: x % 2 == 0, a))
e2 = list(filter(lambda x: x % 2 != 0, b))
o2 = list(filter(lambda x: x % 2 == 0, b))
s = max1(len(e1), len(o2))
f = max1(len(o1), len(e2))
print(f + s)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = [i for i in a if i % 2 == 0]
q = [i for i in a if i % 2 != 0]
x = [i for i in b if i % 2 == 0]
y = [i for i in b if i % 2 != 0]
k = 0
if len(x) > len(q):
	k = k + len(q)
else:
	k = k + len(x)
if len(p) > len(y):
	k = k + len(y)
else:
	k = k + len(p)
print(k)


(n, m) = map(int, input().split())
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))
n1 = 0
lmo = []
lme = []
for i in lm:
	if i % 2 == 0:
		lme.append(i)
	else:
		lmo.append(i)
lno = []
lne = []
for i in ln:
	if i % 2 == 0:
		lne.append(i)
	else:
		lno.append(i)
print(min(len(lmo), len(lne)) + min(len(lme), len(lno)))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
even = sum((1 for i in a + b if i % 2 == 1))
odd = n + m - even
print(min(n, m, even, odd))


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
(n, m) = mi()
a = li()
b = li()
a = [x % 2 for x in a]
b = [x % 2 for x in b]
ans = min(a.count(0), b.count(1)) + min(a.count(1), b.count(0))
print(ans)


(n, m) = map(int, input().split())
sun = list(map(int, input().split()))
keys = list(map(int, input().split()))
a = 0
for i in sun:
	if i % 2 == 0:
		a += 1
b = n - a
c = 0
for i in keys:
	if i % 2 == 0:
		c += 1
d = m - c
ans = 0
ans += min(a, d)
ans += min(b, c)
print(ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
parne_hore = 0
parne_dole = 0
neparne_hore = 0
neparne_dole = 0
for i in a:
	if i % 2 == 0:
		parne_hore += 1
	else:
		neparne_hore += 1
for i in b:
	if i % 2 == 0:
		parne_dole += 1
	else:
		neparne_dole += 1
dvojice_x = min(neparne_dole, parne_hore)
dvojice_y = min(parne_dole, neparne_hore)
print(dvojice_x + dvojice_y)


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
A = [int(i) % 2 for i in input().split()]
B = [int(i) % 2 for i in input().split()]
print(min(A.count(0), B.count(1)) + min(A.count(1), B.count(0)))


(n, m) = list(map(int, input().split()))
nl = list(map(int, input().split()))
ml = list(map(int, input().split()))
counteven = 0
countodd = 0
even = 0
odd = 0
for i in range(n):
	if nl[i] % 2 == 0:
		counteven += 1
	elif nl[i] % 2 != 0:
		countodd += 1
for j in range(m):
	if ml[j] % 2 == 0:
		even += 1
	elif ml[j] % 2 != 0:
		odd += 1
print(min(counteven, odd) + min(countodd, even))


n = list(map(int, list(input().split())))
vect = [n[0], n[1]]
m = list(map(int, list(input().split())))
chest = []
for i in range(vect[0]):
	chest.append(m[i])
l = list(map(int, list(input().split())))
key = []
for i in range(vect[1]):
	key.append(l[i])

def check(li1, li2):
	codd = 0
	ceven = 0
	for foo in li1:
		if foo % 2 == 0:
			ceven += 1
		else:
			codd += 1
	kodd = 0
	keven = 0
	for foo in li2:
		if foo % 2 == 0:
			keven += 1
		else:
			kodd += 1
	c = min(codd, keven) + min(ceven, kodd)
	return c
print(check(chest, key))


vvod = input()
(n, m) = vvod.split()
sn = map(int, input().split(' '))
sm = map(int, input().split(' '))
sn = list(sn)
sm = list(sm)
nechet_sn = 0
chet_sn = 0
for i in range(len(sn)):
	if sn[i] % 2 != 0:
		nechet_sn = nechet_sn + 1
	else:
		chet_sn = chet_sn + 1
nechet_sm = 0
chet_sm = 0
for j in range(len(sm)):
	if sm[j] % 2 != 0:
		nechet_sm = nechet_sm + 1
	else:
		chet_sm = chet_sm + 1
if chet_sn <= nechet_sm:
	p = chet_sn
else:
	p = nechet_sm
if nechet_sn <= chet_sm:
	k = nechet_sn
else:
	k = chet_sm
print(p + k)


(n, m) = map(int, input().split())
c = [*map(int, input().split())]
k = [*map(int, input().split())]
z1 = f1 = z = f = 0
for i in c:
	if i % 2 == 0:
		z += 1
	else:
		f += 1
for i in k:
	if i % 2 == 0:
		z1 += 1
	else:
		f1 += 1
print(min(f, z1) + min(z, f1))


def main():
	(n, k) = map(int, input().split())
	arr1 = list(map(int, input().split()))
	arr2 = list(map(int, input().split()))
	(even1, even2, odd1, odd2) = (0, 0, 0, 0)
	for v in arr1:
		if v % 2 == 0:
			even1 += 1
	odd1 = n - even1
	for v in arr2:
		if v % 2 == 0:
			even2 += 1
	odd2 = k - even2
	ans = min(even1, odd2) + min(even2, odd1)
	print(ans)
main()


(n, m) = map(int, input().split())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]
cto = 0
cte = 0
cto1 = 0
cte1 = 0
for i in range(n):
	if l1[i] % 2 == 1:
		cto += 1
	else:
		cte += 1
for i in range(m):
	if l2[i] % 2 == 1:
		cto1 += 1
	else:
		cte1 += 1
print(min(cto, cte1) + min(cte, cto1))


a = input().split()
n = int(a[0])
m = int(a[1])
a = input().split()
for i in range(n):
	a[i] = int(a[i])
b = input().split()
for i in range(m):
	b[i] = int(b[i])
ao = []
ae = []
bo = []
be = []
for i in range(n):
	if a[i] % 2 == 1:
		ae.append(a[i])
	else:
		ao.append(a[i])
for i in range(m):
	if b[i] % 2 == 1:
		be.append(b[i])
	else:
		bo.append(b[i])
print(min(len(ae), len(bo)) + min(len(ao), len(be)))


(n, m) = map(int, input().split())
s = input()
a = [int(s) for s in s.split()]
s = input()
b = [int(s) for s in s.split()]
l = 0
ach = 0
anoch = 0
bch = 0
bnoch = 0
for i in range(n):
	if a[i] % 2 == 0:
		ach += 1
	else:
		anoch += 1
for j in range(m):
	if b[j] % 2 == 0:
		bch += 1
	else:
		bnoch += 1
print(min(anoch, bch) + min(bnoch, ach))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
co = ce = ko = ke = 0
for i in range(n):
	if a[i] % 2 == 0:
		ce += 1
	else:
		co += 1
for j in range(m):
	if b[j] % 2 == 0:
		ke += 1
	else:
		ko += 1
ans = min(ko, ce) + min(ke, co)
print(ans)


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


(n, m) = list(map(int, input().split()))
c = list(map(int, input().split()))
k = list(map(int, input().split()))
(co, ce, ko, ke) = (0, 0, 0, 0)
for i in range(max(n, m)):
	if i < n:
		if c[i] % 2 == 0:
			ce += 1
		else:
			co += 1
	if i < m:
		if k[i] % 2 == 0:
			ke += 1
		else:
			ko += 1
print(min(ke, co) + min(ko, ce))


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
nec = noc = nek = nok = 0
for a in A:
	if a % 2 == 0:
		nec += 1
	else:
		noc += 1
for b in B:
	if b % 2 == 0:
		nek += 1
	else:
		nok += 1
print(min(nec, nok) + min(noc, nek))


def answer():
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	e1 = [int(x) for x in b if x % 2 == 0]
	o1 = [int(x) for x in b if x % 2]
	e2 = [int(x) for x in c if x % 2 == 0]
	o2 = [int(x) for x in c if x % 2]
	print(min(len(e1), len(o2)) + min(len(o1), len(e2)))
answer()


(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
le1 = sum((i % 2 == 1 for i in chests))
chan1 = n - le1
le2 = sum((i % 2 == 1 for i in keys))
chan2 = m - le2
print(min(chan1, le2) + min(le1, chan2))


(n, m) = input().split(' ')
n = int(n)
m = int(m)
ai = []
ai = input().split(' ')
ai = list(map(int, ai))
bj = []
k = 0
bj = input().split(' ')
bj = list(map(int, bj))
len_odd_chest = len([x for x in ai if x % 2 == 1])
len_odd_keys = len([x for x in bj if x % 2 == 1])
print(min(len_odd_keys, len(ai) - len_odd_chest) + min(len_odd_chest, len(bj) - len_odd_keys))


(n, m) = map(int, input().split())
arr = [int(x) for x in input().split()]
brr = [int(x) for x in input().split()]
count = 0
(a1, a2, b1, b2) = (0, 0, 0, 0)
for i in range(len(arr)):
	if arr[i] % 2 != 0:
		a1 += 1
	else:
		a2 += 1
for j in range(len(brr)):
	if brr[j] % 2 != 0:
		b1 += 1
	else:
		b2 += 1
ans = min(a1, b2) + min(a2, b1)
print(ans)


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


(n, m) = [int(x) for x in input().split(' ')]
a = [int(x) for x in input().split(' ')]
b = [int(x) for x in input().split(' ')]
t_odd = len([x for x in a if x % 2 == 1])
t_even = n - t_odd
k_odd = len([x for x in b if x % 2 == 1])
k_even = m - k_odd
print(min(t_odd, k_even) + min(t_even, k_odd))


(n, m) = input().split()
x = [int(x) for x in input().split()]
y = [int(y) for y in input().split()]
ex = ey = ox = oy = 0
for i in x:
	if i % 2 == 0:
		ex += 1
	else:
		ox += 1
for i in y:
	if i % 2 == 0:
		ey += 1
	else:
		oy += 1
print(min(ex, oy) + min(ox, ey))


(n, m) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
c1 = c2 = 0
for i in range(n):
	if a[i] % 2 == 1:
		c1 += 1
for i in range(m):
	if b[i] % 2 == 1:
		c2 += 1
ans = min(c1, m - c2) + min(c2, n - c1)
print(ans)


def find_num_pairs(arr1, arr2):
	chests_odd = 0
	keys_odd = 0
	for num in arr1:
		if num % 2 == 1:
			chests_odd += 1
	for num in arr2:
		if num % 2 == 1:
			keys_odd += 1
	chests_even = len(arr1) - chests_odd
	keys_even = len(arr2) - keys_odd
	return min(chests_odd, keys_even) + min(chests_even, keys_odd)

def get_input():
	return [int(i) for i in input().split()]
(n, m) = get_input()
print(find_num_pairs(get_input(), get_input()))


(N, M) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
odd_chests = 0
for k in chests:
	if k % 2 != 0:
		odd_chests += 1
odd_keys = 0
for k in keys:
	if k % 2 != 0:
		odd_keys += 1
print(min(odd_chests, len(keys) - odd_keys) + min(odd_keys, len(chests) - odd_chests))


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


(n, k) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
brr = list(map(int, input().strip().split()))
ae = 0
ao = 0
be = 0
bo = 0
for i in range(n):
	if arr[i] % 2 == 0:
		ae += 1
	else:
		ao += 1
for i in range(k):
	if brr[i] % 2 == 0:
		be += 1
	else:
		bo += 1
ans = min(be, ao) + min(ae, bo)
print(ans)


def solve():
	(N, M) = map(int, input().split())
	A = [int(k) for k in input().split()]
	B = [int(k) for k in input().split()]
	(oddA, evenA) = (0, 0)
	(oddB, evenB) = (0, 0)
	for i in range(N):
		if A[i] % 2:
			oddA += 1
		else:
			evenA += 1
	for i in range(M):
		if B[i] % 2:
			oddB += 1
		else:
			evenB += 1
	print(min(oddA, evenB) + min(oddB, evenA))
solve()


(n, m) = tuple(map(int, input().strip().split()))
a = tuple(map(int, input().strip().split()))
b = tuple(map(int, input().strip().split()))
s1 = 0
s2 = 0
s3 = 0
s4 = 0
for i in a:
	if i % 2 == 1:
		s1 += 1
	else:
		s2 += 1
for i in b:
	if i % 2 == 1:
		s3 += 1
	else:
		s4 += 1
print(min(s1, s4) + min(s2, s3))


while True:
	try:
		(n, m) = map(int, input().strip().split())
		a = list(map(int, input().strip().split()))
		b = list(map(int, input().strip().split()))
		(ae, ao, be, bo) = (0, 0, 0, 0)
		for n in a:
			if n % 2 == 0:
				ae += 1
			else:
				ao += 1
		for n in b:
			if n % 2 == 0:
				be += 1
			else:
				bo += 1
		print(min(ae, bo) + min(ao, be))
	except:
		break


def pre(n, m, a, b):
	cou = 0
	nt = 0
	mv = 0
	pv = 0
	for i in range(n):
		if a[i] % 2 == 0:
			cou += 1
		else:
			nt += 1
	for j in range(m):
		if b[j] % 2 == 0:
			mv += 1
		else:
			pv += 1
	x = min(cou, pv)
	y = min(nt, mv)
	ans = x + y
	return ans
(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = pre(n, m, a, b)
print(ans)


import sys

def count_odd_even(a_list):
	(odd_cnt, even_cnt) = (0, 0)
	for elem in a_list:
		if elem % 2 == 1:
			odd_cnt += 1
		else:
			even_cnt += 1
	return (odd_cnt, even_cnt)
sys.stdin.readline().strip()
line = sys.stdin.readline().strip()
a = list(map(int, line.split()))
line = sys.stdin.readline().strip()
b = list(map(int, line.split()))
(a_odd, a_even) = count_odd_even(a)
(b_odd, b_even) = count_odd_even(b)
print(min(a_odd, b_even) + min(a_even, b_odd))


(a, b) = map(int, input().split())
z = list(map(int, input().split()))
ke = list(map(int, input().split()))
o1 = 0
e1 = 0
o2 = 0
e2 = 0
for i in range(len(z)):
	if z[i] % 2 == 1:
		o1 += 1
	else:
		e1 += 1
for i in range(len(ke)):
	if ke[i] % 2 == 1:
		o2 += 1
	else:
		e2 += 1
print(min(o1, e2) + min(o2, e1))


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


(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
(A, B) = (0, 0)
for i in chests:
	if i % 2 == 1:
		A += 1
for i in keys:
	if i % 2 == 1:
		B += 1
print(min(A, m - B) + min(B, n - A))


(n, m) = map(int, input().split())
ai = [int(x) for x in input().split()]
bi = [int(x) for x in input().split()]
(ai_even, bi_even) = (0, 0)
for x in range(max(n, m)):
	if x < n and ai[x] % 2 == 0:
		ai_even += 1
	if x < m and bi[x] % 2 == 0:
		bi_even += 1
print(min(ai_even, m - bi_even) + min(n - ai_even, bi_even))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
odd1 = odd2 = even1 = even2 = 0
for i in a:
	if i % 2:
		odd1 += 1
	else:
		even1 += 1
for i in b:
	if i % 2:
		odd2 += 1
	else:
		even2 += 1
print(min(odd1, even2) + min(odd2, even1))


def main():
	(n, m) = map(int, input().split())
	arr = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cnt01 = 0
	cnt02 = 0
	for i in range(n):
		if arr[i] % 2 != 0:
			cnt01 += 1
	for j in range(m):
		if b[j] % 2 != 0:
			cnt02 += 1
	print(min(n - cnt01, cnt02) + min(cnt01, m - cnt02))
main()


def find(a):
	for k in range(len(a)):
		if a[k] % 2 == 1:
			a[k] = 1
		elif a[k] % 2 == 0:
			a[k] = 0
	return a

def count1(a):
	count = 0
	for k in range(len(a)):
		if a[k] == 1:
			count += 1
	return count
number_chestkey = input()
chestkey = number_chestkey.split()
number_chest = chestkey[0]
nummber_key = chestkey[1]
numberon_chest = input()
Chest = [int(n) for n in numberon_chest.split()]
numberon_key = input()
Key = [int(n) for n in numberon_key.split()]
Chest = find(Chest)
countChest = count1(Chest)
Key = find(Key)
countKey = count1(Key)
total = min(countChest, len(Key) - countKey) + min(countKey, len(Chest) - countChest)
print(total)


input()
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
odd_chest = 0
even_chest = 0
odd_keys = 0
even_keys = 0
for c in chest:
	if c % 2 == 0:
		even_chest += 1
	else:
		odd_chest += 1
for key in keys:
	if key % 2 == 0:
		even_keys += 1
	else:
		odd_keys += 1
result = 0
result += min(odd_chest, even_keys)
result += min(even_chest, odd_keys)
print(result)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
input = stdin.readline
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
(n, m) = mapin()
a = listin()
b = listin()
(odd_a, odd_b) = (0, 0)
(even_a, even_b) = (0, 0)
for i in a:
	if i % 2:
		odd_a += 1
	else:
		even_a += 1
for i in b:
	if i % 2:
		odd_b += 1
	else:
		even_b += 1
print(min(odd_a, even_b) + min(even_a, odd_b))


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


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


(chest, key) = map(int, input().split())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
(even1, odd1, even2, odd2) = (0, 0, 0, 0)
for x in range(chest):
	if b[x] % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
for x in range(key):
	if c[x] % 2 == 0:
		even2 += 1
	else:
		odd2 += 1
print(min(even2, odd1) + min(even1, odd2))


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


(n, m) = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
first_a = []
second_a = []
first_b = []
second_b = []
for i in range(n):
	if a[i] % 2 == 0:
		first_a.append(a[i])
	else:
		second_a.append(a[i])
for i in range(m):
	if b[i] % 2 == 0:
		first_b.append(b[i])
	else:
		second_b.append(b[i])
print(min(len(first_a), len(second_b)) + min(len(second_a), len(first_b)))


import math
import sys
DEBUG = False

def inp():
	return sys.stdin.readline().rstrip()

def dprint(*value, sep=' ', end='\n'):
	if DEBUG:
		print(*value, sep=sep, end=end)

def solve(N, M, A, B):
	a_even = len([a for a in A if a % 2 == 0])
	a_odd = N - a_even
	b_even = len([b for b in B if b % 2 == 0])
	b_odd = M - b_even
	return min(a_even, b_odd) + min(a_odd, b_even)

def main():
	(N, M) = [int(e) for e in inp().split()]
	A = [int(e) for e in inp().split()]
	B = [int(e) for e in inp().split()]
	print(solve(N, M, A, B))
main()


b = input()
l1 = input().split()
l2 = input().split()
mat = [[0, 0], [0, 0]]
for i in l1:
	if i != '':
		i = int(i)
		if i % 2 == 0:
			mat[0][0] += 1
		else:
			mat[1][1] += 1
for j in l2:
	if j != '':
		j = int(j)
		if j % 2 == 0:
			mat[0][1] += 1
		else:
			mat[1][0] += 1
sum = min(mat[0][0], mat[1][0]) + min(mat[1][1], mat[0][1])
print(sum)


(n, m) = input().split()
n = int(n)
m = int(m)
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
chesto = 0
cheste = 0
keyo = 0
keye = 0
for i in chest:
	if i % 2 == 0:
		cheste += 1
	else:
		chesto += 1
for i in keys:
	if i % 2 == 0:
		keye += 1
	else:
		keyo += 1
count = min(chesto, keye) + min(cheste, keyo)
print(count)


(n, m) = list(map(int, input().rstrip().split()))
l = list(map(int, input().rstrip().split()))
q = list(map(int, input().rstrip().split()))
l1 = 0
l2 = 0
q1 = 0
q2 = 0
for x in l:
	if x % 2 == 0:
		l2 += 1
	else:
		l1 += 1
for x in q:
	if x % 2 == 0:
		q2 += 1
	else:
		q1 += 1
s = 0
s = s + min(q1, l2) + min(q2, l1)
print(s)


(n, m) = map(int, input().split())
A = [*map(int, input().split())]
B = [*map(int, input().split())]
(ao, ae) = (0, 0)
(bo, be) = (0, 0)
for a in A:
	if a % 2 == 0:
		ae += 1
	else:
		ao += 1
for b in B:
	if b % 2 == 0:
		be += 1
	else:
		bo += 1
print(min(ao, be) + min(ae, bo))


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


(box, key) = (int(i) for i in input().split())
boxes = [int(i) for i in input().split()]
keys = [int(i) for i in input().split()]
cntbev = 0
for i in boxes:
	if i % 2 == 0:
		cntbev += 1
cntbodd = len(boxes) - cntbev
cntkev = 0
for i in keys:
	if i % 2 == 0:
		cntkev += 1
cntkodd = len(keys) - cntkev
count = min(cntbev, cntkodd)
count += min(cntbodd, cntkev)
print(count)


(n, m) = input().split()
ch = [int(i) for i in input().split()]
ke = [int(i) for i in input().split()]
even1 = 0
for elt in ch:
	if elt % 2 == 0:
		even1 += 1
even2 = 0
for elt in ke:
	if elt % 2 == 0:
		even2 += 1
odd1 = len(ch) - even1
odd2 = len(ke) - even2
print(min(even1, odd2) + min(even2, odd1))


(a, b) = map(int, input().split())
c = [int(x) % 2 for x in input().split()]
d = [int(x) % 2 for x in input().split()]
print(min(c.count(0), d.count(1)) + min(d.count(0), c.count(1)))


def evenOdd(a):
	l = [0, 0]
	for i in a:
		if i % 2 == 0:
			l[0] += 1
		else:
			l[1] += 1
	return l

def soln(a, b):
	aa = evenOdd(a)
	bb = evenOdd(b)
	return min(aa[0], bb[1]) + min(aa[1], bb[0])
n = list(map(int, input().split()))
tc = list(map(int, input().split()))
keys = list(map(int, input().split()))
print(soln(tc, keys))


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


def inputDelimiter(inputStr):
	return list(map(int, inputStr.split(' ')))

def numberCounter(inputList):
	odd = sum([inputList[i] % 2 != 0 for i in range(0, len(inputList))])
	even = len(inputList) - odd
	return [even, odd]
temp = inputDelimiter(input())
n = temp[0]
m = temp[1]
temp = inputDelimiter(input())
oddChests = numberCounter(temp)[0]
evenChests = numberCounter(temp)[1]
temp = inputDelimiter(input())
oddKeys = numberCounter(temp)[0]
evenKeys = numberCounter(temp)[1]
result = 0
if oddKeys <= evenChests:
	result += oddKeys
else:
	result += evenChests
if evenKeys <= oddChests:
	result += evenKeys
else:
	result += oddChests
print(result)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aEven = 0
aOdd = 0
bEven = 0
bOdd = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		aEven = aEven + 1
	else:
		aOdd = aOdd + 1
for i in range(len(b)):
	if b[i] % 2 == 0:
		bEven = bEven + 1
	else:
		bOdd = bOdd + 1
print(min(aEven, bOdd) + min(aOdd, bEven))


(n, m) = map(int, input().split(' '))
array1 = list(map(int, input().split(' ')))
array2 = list(map(int, input().split(' ')))
odd1 = 0
odd2 = 0
even1 = 0
even2 = 0
for i in range(n):
	if array1[i] % 2 == 0:
		even1 = even1 + 1
	else:
		odd1 = odd1 + 1
for i in range(m):
	if array2[i] % 2 == 0:
		even2 = even2 + 1
	else:
		odd2 = odd2 + 1
minimum1 = min(odd1, even2)
minimum2 = min(even1, odd2)
sum1 = minimum1 + minimum2
print(sum1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x1 = 0
y1 = 0
for i in a:
	if i % 2 == 0:
		x1 += 1
	else:
		y1 += 1
x2 = 0
y2 = 0
for i in b:
	if i % 2 == 0:
		x2 += 1
	else:
		y2 += 1
ans = min(x1, y2) + min(x2, y1)
print(ans)


(n, m) = map(int, input().split())
(xn, xm) = ([int(i) % 2 for i in input().split()], [int(j) % 2 for j in input().split()])
(xn_even, xn_odd) = (len(xn) - sum(xn), sum(xn))
(xm_even, xm_odd) = (len(xm) - sum(xm), sum(xm))
print(min(xn_even, xm_odd) + min(xn_odd, xm_even))


(m, n) = list(map(int, input().split()))
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
ch_odd = 0
ch_even = 0
key_odd = 0
key_even = 0
for i in chest:
	if i % 2 == 0:
		ch_even += 1
	else:
		ch_odd += 1
for i in key:
	if i % 2 == 0:
		key_even += 1
	else:
		key_odd += 1
an = min(ch_even, key_odd) + min(ch_odd, key_even)
print(an)


(n, k) = map(int, input().split())
x = list(map(int, input().split()))[:n]
y = list(map(int, input().split()))[:k]
e1 = 0
o1 = 0
e2 = 0
o2 = 0
for i in x:
	if i % 2 != 0:
		o1 += 1
	else:
		e1 += 1
for k in y:
	if k % 2 != 0:
		o2 += 1
	else:
		e2 += 1
print(min(o1, e2) + min(o2, e1))


import math
(N, M) = list(map(int, input().lstrip().split()))
chests = list(map(int, input().lstrip().split()))
keys = list(map(int, input().lstrip().split()))
odd = 0
even = 0
for c in chests:
	if c % 2:
		odd += 1
	else:
		even += 1
res = 0
for k in keys:
	if k % 2:
		if even:
			res += 1
			even -= 1
	elif odd:
		res += 1
		odd -= 1
print(res)


I = lambda : map(int, input().split())
(n, m) = I()
l1 = list(I())
l2 = list(I())
c1 = 0
c2 = 0
for i in l1:
	if i % 2 == 0:
		c1 += 1
for i in l2:
	if i % 2 == 0:
		c2 += 1
ans = min(c2, n - c1) + min(c1, m - c2)
print(ans)


(n, m) = map(int, input().split())
(ce, ke) = (0, 0)
(che, key) = (list(map(int, input().split())), list(map(int, input().split())))
for i in che:
	if i % 2 == 0:
		ce += 1
for j in key:
	if j % 2 == 0:
		ke += 1
print(min(ce, m - ke) + min(n - ce, ke))


R = lambda : map(int, input().split())
(n, m) = R()
(a, b) = ([*R()], [*R()])
(oda, odb) = (sum((1 for i in a if i % 2 == 1)), sum((1 for i in b if i % 2 == 1)))
print(min(oda, m - odb) + min(n - oda, odb))


def treasure(n, m, l1, l2):
	(e1, e2, o1, o2) = (0, 0, 0, 0)
	for item in l1:
		if item % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	for item in l2:
		if item % 2 == 0:
			e2 += 1
		else:
			o2 += 1
	print(min(e1, o2) + min(e2, o1))
l = list(map(int, input().split()))
(n, m) = (l[0], l[1])
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
treasure(n, m, l1, l2)


N = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
noddA = 0
evenA = 0
noddB = 0
evenB = 0
for i in range(N[0]):
	if A[i] % 2 == 1:
		noddA += 1
	else:
		evenA += 1
for i in range(N[1]):
	if B[i] % 2 == 1:
		noddB += 1
	else:
		evenB += 1
print(min(noddA, evenB) + min(noddB, evenA))


_ = input()
chests = list(map(int, input().split(' ')))
keys = list(map(int, input().split(' ')))
even_num_chests = len(list(filter(lambda x: x % 2 == 0, chests)))
even_num_keys = len(list(filter(lambda x: x % 2 == 0, keys)))
odd_num_chests = len(list(filter(lambda x: x % 2 == 1, chests)))
odd_num_keys = len(list(filter(lambda x: x % 2 == 1, keys)))
print(min(even_num_chests, odd_num_keys) + min(even_num_keys, odd_num_chests))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
oa = ea = ob = eb = 0
for i in a:
	if i % 2 == 0:
		oa += 1
	else:
		ea += 1
for i in b:
	if i % 2 == 0:
		ob += 1
	else:
		eb += 1
print(min(oa, eb) + min(ea, ob))


gi = lambda : list(map(int, input().strip().split()))
(n, m) = gi()
a = gi()
b = gi()
ev = len([e for e in a if e % 2 == 0])
od = len([e for e in a if e % 2])
ev1 = len([e for e in b if e % 2 == 0])
od1 = len([e for e in b if e % 2])
print(min(ev1, od) + min(od1, ev))


R = lambda : map(int, input().split())
(n, m) = R()
(a, b) = [sum((x % 2 for x in R())) for _ in range(2)]
print(min(a, m - b) + min(n - a, b))


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
a = 0
l1e = []
l1o = []
l2e = []
l2o = []
for i in range(len(l1)):
	if l1[i] % 2 == 0:
		l1e.append(l1[i])
	elif l1[i] % 2 == 1:
		l1o.append(l1[i])
for j in range(len(l2)):
	if l2[j] % 2 == 0:
		l2e.append(l2[j])
	elif l2[j] % 2 == 1:
		l2o.append(l2[j])
if len(l2e) > len(l1o):
	a = a + len(l1o)
if len(l2e) < len(l1o):
	a = a + len(l2e)
if len(l2e) == len(l1o):
	a = a + len(l2e)
if len(l2o) > len(l1e):
	a = a + len(l1e)
if len(l2o) < len(l1e):
	a = a + len(l2o)
if len(l2o) == len(l1e):
	a = a + len(l2o)
print(a)


(a, b) = input().split(' ')
m = list(map(int, input().split(' ')))
n = list(map(int, input().split(' ')))
e = 0
f = 0
for i in m:
	if i % 2 == 0:
		e += 1
g = int(a) - e
for k in n:
	if k % 2 == 0:
		f += 1
h = int(b) - f
print(min(e, h) + min(f, g))


(n, m) = map(int, input().split())
a = input().split()
b = input().split()
p = 0
q = 0
for i in range(n):
	if int(a[i]) % 2 == 0:
		p += 1
for j in range(m):
	if int(b[j]) % 2 == 1:
		q += 1
print(min(p, q) + min(n - p, m - q))


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()]
ODD = lambda y: len([x for x in y if x % 2])
(a, b) = RMI()
(ao, bo) = (ODD(RMI()), ODD(RMI()))
print(min(ao, b - bo) + min(bo, a - ao))


def main():
	(n, m) = map(int, input().split())
	x = list(map(int, input().split()))
	y = list(map(int, input().split()))
	ex = [i for i in x if i % 2 == 0]
	ox = [i for i in x if i % 2 != 0]
	ey = [i for i in y if i % 2 == 0]
	oy = [i for i in y if i % 2 != 0]
	print(min(len(ex), len(oy)) + min(len(ey), len(ox)))
main()


import math

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

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

def li():
	return list(mi())
(n, m) = tuple(mi())
a = li()
b = li()
e = 0
o = 0
for i in a:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
ans = 0
for i in b:
	if i % 2 == 0 and o > 0:
		ans += 1
		o -= 1
	elif i % 2 == 1 and e > 0:
		ans += 1
		e -= 1
print(ans)


def main():
	input()
	chests = [int(_) for _ in input().split()]
	keys = [int(_) for _ in input().split()]
	chests_odd = sum((x % 2 != 0 for x in chests))
	chests_even = sum((x % 2 == 0 for x in chests))
	keys_odd = sum((x % 2 != 0 for x in keys))
	keys_even = sum((x % 2 == 0 for x in keys))
	result = min(keys_odd, chests_even) + min(keys_even, chests_odd)
	print(result)
main()


import sys
import math
input = sys.stdin.readline
(n, m) = map(int, input().split())
alist = list(map(int, input().split()))
blist = list(map(int, input().split()))
ae = 0
ao = 0
be = 0
bo = 0
for i in range(n):
	if alist[i] % 2 == 0:
		ae += 1
	else:
		ao += 1
for i in range(m):
	if blist[i] % 2 == 0:
		be += 1
	else:
		bo += 1
print(min(ae, bo) + min(ao, be))


(n, m) = map(int, input().split())
keys = list(map(lambda x: int(x) % 2, input().split()))
chests = list(map(lambda x: int(x) % 2, input().split()))
(k1, l1) = (sum(keys), sum(chests))
(k2, l2) = (n - k1, m - l1)
print(min(k1, l2) + min(k2, l1))


def main():
	buf = input()
	buflist = buf.split()
	n = int(buflist[0])
	m = int(buflist[1])
	buf = input()
	buflist = buf.split()
	a = list(map(int, buflist))
	buf = input()
	buflist = buf.split()
	b = list(map(int, buflist))
	chest_even = 0
	chest_odd = 0
	key_even = 0
	key_odd = 0
	for i in a:
		if i % 2 == 0:
			chest_even += 1
		else:
			chest_odd += 1
	for i in b:
		if i % 2 == 0:
			key_even += 1
		else:
			key_odd += 1
	open_count = min(chest_even, key_odd) + min(chest_odd, key_even)
	print(open_count)
main()


(n, m) = map(int, input().split())
(*a,) = map(int, input().split())
(*b,) = map(int, input().split())
(a1, b1) = (len([i for i in a if i % 2]), len([i for i in b if i % 2]))
print(min(a1, m - b1) + min(n - a1, b1))


(n, m) = map(int, input().strip().split())
chest = list(map(int, input().strip().split()))
keyss = list(map(int, input().strip().split()))
od_chests = 0
for i in chest:
	if i % 2 == 1:
		od_chests += 1
ev_chests = n - od_chests
od_keys = 0
for i in keyss:
	if i % 2 == 1:
		od_keys += 1
ev_keys = m - od_keys
ans = min(od_chests, ev_keys) + min(od_keys, ev_chests)
print(ans)


(n, m) = map(int, input().split())
c = list(map(int, input().split()))
k = list(map(int, input().split()))
cOdd = 0
cEven = 0
kOdd = 0
kEven = 0
for i in range(n):
	if c[i] % 2 != 0:
		cOdd += 1
	else:
		cEven += 1
for i in range(m):
	if k[i] % 2 != 0:
		kOdd += 1
	else:
		kEven += 1
print(min(cOdd, kEven) + min(cEven, kOdd))


import sys
from collections import *
from math import *
import re

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)

def even(n):
	return [False, True][0 if n % 2 else 1]
max_int = sys.maxsize
mod = 10 ** 9 + 7
(n, m) = inp()
(a, b) = (inp_arr(), inp_arr())
c1 = c2 = 0
for i in a:
	if not even(i):
		c1 += 1
for i in b:
	if not even(i):
		c2 += 1
print(min(c2, n - c1) + min(c1, m - c2))


(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
chestOddEven = [0, 0]
keyOddEven = [0, 0]
for i in chests:
	if i % 2 == 0:
		chestOddEven[1] += 1
	else:
		chestOddEven[0] += 1
for i in keys:
	if i % 2 == 0:
		keyOddEven[1] += 1
	else:
		keyOddEven[0] += 1
print(min(chestOddEven[0], keyOddEven[1]) + min(chestOddEven[1], keyOddEven[0]))


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A = list(map(lambda x: x % 2, A))
B = list(map(lambda x: x % 2, B))
s = A.count(0)
t = A.count(1)
s2 = B.count(0)
t2 = B.count(1)
print(min(s, t2) + min(t, s2))


def treasureKey(n, m, treasure, key):
	(evenKey, oddKey) = (0, 0)
	(evenTresure, oddTreasure) = (0, 0)
	count = 0
	for i in range(m):
		if key[i] % 2 == 0:
			evenKey += 1
		else:
			oddKey += 1
	for i in range(n):
		if treasure[i] % 2 == 0:
			evenTresure += 1
		else:
			oddTreasure += 1
	while oddKey > 0 and evenTresure > 0:
		evenTresure -= 1
		oddKey -= 1
		count += 1
	while oddTreasure > 0 and evenKey > 0:
		evenKey -= 1
		oddTreasure -= 1
		count += 1
	return count
(n, m) = map(int, input().split())
treasure = [int(i) for i in input().split()]
keys = [int(i) for i in input().split()]
print(treasureKey(n, m, treasure, keys))


(n, m) = list(map(int, input().split(' ')))
chests = list(map(int, input().split(' ')))
keys = list(map(int, input().split(' ')))
n_odd = sum([1 if el % 2 == 0 else 0 for el in chests])
n_even = n - n_odd
m_odd = sum([1 if el % 2 == 0 else 0 for el in keys])
m_even = m - m_odd
print(min(n_even, m_odd) + min(n_odd, m_even))


[n, m] = [int(x) for x in input().split()]
treasures = [int(x) % 2 == 0 for x in input().split()]
chests = [int(x) % 2 == 0 for x in input().split()]
print(min(sum([x == True for x in treasures]), sum([x == False for x in chests])) + min(sum([x == True for x in chests]), sum([x == False for x in treasures])))


L = lambda : map(int, input().split())
(n, m) = L()
A = list(L())
B = list(L())
A = [a % 2 for a in A]
B = [a % 2 for a in B]
print(min(sum(A), m - sum(B)) + min(sum(B), n - sum(A)))


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = [int(x) % 2 for x in input().split()]
d = [int(x) % 2 for x in input().split()]
e1 = c.count(0)
o1 = c.count(1)
e2 = d.count(0)
o2 = d.count(1)
print(min(e1, o2) + min(e2, o1))


(n, m) = tuple(map(int, input().split()))
k = [int(i) for i in input().split()]
v = [int(i) for i in input().split()]
ke = 0
ko = 0
ve = 0
vo = 0
for i in k:
	if i % 2 == 0:
		ke += 1
	else:
		ko += 1
for i in v:
	if i % 2 == 0:
		ve += 1
	else:
		vo += 1
ans = 0
if ko > ve:
	ans += ve
else:
	ans += ko
if vo > ke:
	ans += ke
else:
	ans += vo
print(ans)


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


(n, m) = [int(x) for x in input().split()]
chest = [int(x) for x in input().split()]
key = [int(x) for x in input().split()]
n_odd = 0
n_even = 0
m_odd = 0
m_even = 0
for element in chest:
	if element % 2 == 0:
		n_even += 1
	else:
		n_odd += 1
for element in key:
	if element % 2 == 0:
		m_even += 1
	else:
		m_odd += 1
print(min(m_odd, n_even) + min(m_even, n_odd))


a = input().split(' ')
q = int(a[0])
p = int(a[1])
i = 0
j = 0
n = 0
m = 0
jh = 0
kh = 0
c = input().split(' ')
k = input().split(' ')
while i < q:
	z = int(c[i])
	z1 = z % 2
	if z1 == 1:
		n += 1
	else:
		pass
	i += 1
while j < p:
	x = int(k[j])
	x1 = x % 2
	if x1 == 1:
		m += 1
	else:
		pass
	j += 1
odd1 = n
even1 = q - n
odd2 = m
even2 = p - m
if odd1 < even2:
	jh = odd1
elif odd1 > even2:
	jh = even2
elif odd1 == even2:
	jh = odd1
if even1 < odd2:
	kh = even1
elif even1 > odd2:
	kh = odd2
elif even1 == odd2:
	kh = even1
print(jh + kh)


x = input()
xx = x.split()
n = int(xx[0])
m = int(xx[1])
chest_f = []
chest_z = []
key_f = []
key_z = []
x = input()
xx = x.split()
for i in xx:
	if int(i) % 2 == 1:
		chest_f.append(i)
	else:
		chest_z.append(i)
x = input()
xx = x.split()
for i in xx:
	if int(i) % 2 == 1:
		key_f.append(i)
	else:
		key_z.append(i)
kf = len(key_f)
kz = len(key_z)
cf = len(chest_f)
cz = len(chest_z)
s = 0
fard = [cf, kz]
zoj = [cz, kf]
s = s + min(fard) + min(zoj)
print(s)


nm = [int(c) for c in input().split()]
na = [int(c) % 2 for c in input().split()]
mb = [int(c) % 2 for c in input().split()]
print(min(mb.count(0), na.count(1)) + min(mb.count(1), na.count(0)))


input()
result = 0
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
even_chests = 0
odd_chests = 0
even_keys = 0
odd_keys = 0
for i in chests:
	if i % 2 == 0:
		even_chests += 1
	else:
		odd_chests += 1
for i in keys:
	if i % 2 == 0:
		even_keys += 1
	else:
		odd_keys += 1
diff = min(odd_keys, even_chests)
odd_keys -= diff
even_chests -= diff
result += diff
diff = min(even_keys, odd_chests)
even_keys -= diff
odd_chests -= diff
result += diff
print(result)


(ch, ke) = list(map(int, input().split()))
nu_che = list(map(int, input().split()))
nu_ke = list(map(int, input().split()))
che_npar = 0
che_par = 0
ke_npar = 0
ke_par = 0
for i in range(ch):
	if nu_che[i] % 2 == 0:
		che_par += 1
	else:
		che_npar += 1
for i in range(ke):
	if nu_ke[i] % 2 == 0:
		ke_par += 1
	else:
		ke_npar += 1
print(min(che_npar, ke_par) + min(che_par, ke_npar))


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n
primes = []

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	else:
		return int(input())
(n, m) = f(1)
a = f(2)
b = f(2)
count1 = 0
count2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		count1 += 1
for i in range(m):
	if b[i] % 2 == 0:
		count2 += 1
print(min(m - count2, count1) + min(count2, n - count1))


def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	odd = 0
	even = 0
	for i in range(n):
		if a[i] & 1:
			odd += 1
		else:
			even += 1
	b = list(map(int, input().split()))
	ans = 0
	for i in range(m):
		if b[i] & 1:
			if even:
				even -= 1
				ans += 1
		elif odd:
			odd -= 1
			ans += 1
	print(ans)
	return 0
main()


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


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ec = 0
ek = 0
oc = 0
ok = 0
for i in range(len(a if n > m else b)):
	try:
		if a[i] % 2 == 0:
			ec += 1
		else:
			oc += 1
	except:
		pass
	try:
		if b[i] % 2 == 0:
			ek += 1
		else:
			ok += 1
	except:
		pass
print(min(ec, ok) + min(oc, ek))


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
chestOdd = list(filter(lambda x: x % 2 == 1, chest))
chestEven = list(filter(lambda x: x % 2 == 0, chest))
keyOdd = list(filter(lambda x: x % 2 == 1, key))
keyEven = list(filter(lambda x: x % 2 == 0, key))
ans = min(len(chestOdd), len(keyEven))
ans += min(len(chestEven), len(keyOdd))
print(ans)


(n, m) = map(int, input().split())
(a, b) = (sum((x & 1 for x in map(int, input().split()))) for _ in 'ab')
print(min(n - a, b) + min(m - b, a))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
odd = len([i for i in a if i % 2])
odd_2 = len([i for i in b if i % 2])
print(min(odd, m - odd_2) + min(n - odd, odd_2))


from sys import stdin
input = stdin.readline
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c1 = 0
c2 = 0
d1 = d2 = 0
for i in a:
	if i % 2 == 0:
		c1 += 1
	else:
		c2 += 1
for i in b:
	if i % 2 == 0:
		d1 += 1
	else:
		d2 += 1
print(min(c1, d2) + min(d1, c2))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cntA1 = 0
cntA2 = 0
for i in a:
	if i % 2 == 0:
		cntA2 += 1
	else:
		cntA1 += 1
cntB1 = 0
cntB2 = 0
for j in b:
	if j % 2 == 0:
		cntB2 += 1
	else:
		cntB1 += 1
print(min(cntA1, cntB2) + min(cntA2, cntB1))


(n, m) = map(int, input().split())
n1 = list(map(int, input().split()))
m1 = list(map(int, input().split()))
n1o = []
n1e = []
m1o = []
m1e = []
for i in range(len(n1)):
	if n1[i] % 2 == 0:
		n1e.append(n1[i])
	else:
		n1o.append(n1[i])
for i in range(len(m1)):
	if m1[i] % 2 == 0:
		m1e.append(m1[i])
	else:
		m1o.append(m1[i])
c = min(len(n1o), len(m1e))
d = min(len(m1o), len(n1e))
print(c + d)


(n, m) = map(int, input().split(' '))
bag = list(map(int, input().split(' ')))
key = list(map(int, input().split(' ')))
kol = 0
kol2 = 0
ch_bag = 0
nch_bag = 0
for i in bag:
	if i % 2 == 0:
		ch_bag = ch_bag + 1
	else:
		nch_bag = nch_bag + 1
ch_key = 0
nch_key = 0
for i in key:
	if i % 2 == 0:
		ch_key = ch_key + 1
	else:
		nch_key = nch_key + 1
answer = min(ch_key, nch_bag) + min(nch_key, ch_bag)
print(answer)


def solve(n, m, a, b):
	(pa, ia) = (0, 0)
	for i in a:
		if i % 2 == 0:
			pa += 1
	ia = n - pa
	(pb, ib) = (0, 0)
	for i in b:
		if i % 2 == 0:
			pb += 1
	ib = m - pb
	return min(ib, pa) + min(ia, pb)

def main():
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solve(n, m, a, b))
main()


nm = input()
n = [int(x) for x in input().split(' ')]
m = [int(x) for x in input().split(' ')]
nOdd = sum((1 for x in n if x % 2 == 1))
nEven = len(n) - nOdd
mOdd = sum((1 for x in m if x % 2 == 1))
mEven = len(m) - mOdd
ans = min(nOdd, mEven) + min(nEven, mOdd)
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a_odd = [i % 2 for i in a]
b_even = [i % 2 for i in b]
print(min(sum(a_odd), m - sum(b_even)) + min(sum(b_even), n - sum(a_odd)))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_strList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
(n, m) = get_list()
chest = get_list()
keys = get_list()
chest_even = 0
chest_odd = 0
key_even = 0
key_odd = 0
for i in chest:
	if i & 1 != 1:
		chest_even += 1
	else:
		chest_odd += 1
for j in keys:
	if j & 1 != 1:
		key_even += 1
	else:
		key_odd += 1
m = min(chest_even, key_odd)
n = min(chest_odd, key_even)
print(m + n)


(n, m) = map(int, input().split())
arr = [int(x) for x in input().split()]
brr = [int(x) for x in input().split()]
ao = 0
ae = 0
for x in arr:
	if x % 2 == 0:
		ae += 1
	else:
		ao += 1
bo = 0
be = 0
for x in brr:
	if x % 2 == 0:
		be += 1
	else:
		bo += 1
print(min(ao, be) + min(ae, bo))


(n, m) = map(int, input().split())
eleN = input()
eleM = input()
n_list = eleN.split()
m_list = eleM.split()
c0 = 0
c1 = 0
k0 = 0
k1 = 0
for i in range(n):
	if int(n_list[i]) % 2 == 0:
		c0 += 1
	else:
		c1 += 1
for i in range(m):
	if int(m_list[i]) % 2 == 0:
		k0 += 1
	else:
		k1 += 1
ans = min(c1, k0) + min(c0, k1)
print(ans)


s = [int(n) for n in input().split()]
a = [int(n) % 2 for n in input().split()]
b = [int(n) % 2 for n in input().split()]
o1 = a.count(1)
o2 = b.count(1)
e1 = a.count(0)
e2 = b.count(0)
x = min(o1, e2)
y = min(o2, e1)
print(x + y)


arr_str = input().split()
(n, m) = (arr_str[0], arr_str[1])
arr_str = input().split()
a = [int(x) for x in arr_str]
arr_str = input().split()
b = [int(x) for x in arr_str]
a_odd = 0
for el in a:
	if el % 2 == 1:
		a_odd += 1
a_even = len(a) - a_odd
b_odd = 0
for el in b:
	if el % 2 == 1:
		b_odd += 1
b_even = len(b) - b_odd
ans = min(b_odd, a_even) + min(a_odd, b_even)
print(ans)


(a, b) = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
k = [int(x) for x in input().split()]
even_c = 0
odd_c = 0
even_k = 0
odd_k = 0
for i in c:
	if i % 2 == 0:
		even_c += 1
	else:
		odd_c += 1
for i in k:
	if i % 2 == 0:
		even_k += 1
	else:
		odd_k += 1
print(min(even_k, odd_c) + min(odd_k, even_c))


(n, m) = input().split()
t = list(map(int, input().split()))
k = list(map(int, input().split()))
et = []
ot = []
ek = []
ok = []
for i in t:
	if i % 2 == 0:
		et.append(i)
	else:
		ot.append(i)
for i in k:
	if i % 2 == 0:
		ek.append(i)
	else:
		ok.append(i)
print(min(len(et), len(ok)) + min(len(ot), len(ek)))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(odd, oddn) = (0, 0)
(even, eve) = (0, 0)
for i in range(m):
	if b[i] % 2:
		odd = odd + 1
	else:
		even = even + 1
for j in range(n):
	if a[j] % 2:
		oddn = oddn + 1
	else:
		eve = eve + 1
mo = min(odd, eve)
me = min(even, oddn)
print(mo + me)


(N, M) = map(int, input().split())
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
a_odd = [a for a in a_list if a % 2 == 1]
a_even = [a for a in a_list if a % 2 == 0]
b_odd = [b for b in b_list if b % 2 == 1]
b_even = [b for b in b_list if b % 2 == 0]
print(min(len(a_odd), len(b_even)) + min(len(a_even), len(b_odd)))


from sys import stdin, stdout
arr = list(map(int, stdin.readline().split()))
n = arr[0]
m = arr[1]
A = [int(i) % 2 for i in stdin.readline().split()]
B = [int(i) % 2 for i in stdin.readline().split()]
print(min(A.count(0), B.count(1)) + min(A.count(1), B.count(0)))


(m, n) = map(int, input().split())
odd_first = [x % 2 for x in map(int, input().split())]
odd_second = [x % 2 for x in map(int, input().split())]
odd_first = sum(odd_first)
odd_second = sum(odd_second)
print(min(odd_first, n - odd_second) + min(m - odd_first, odd_second))


(n, m) = map(int, input().split())
i = list(map(int, input().split()))
j = list(map(int, input().split()))
oddi = 0
eveni = 0
for x in i:
	if x % 2 == 1:
		oddi += 1
	else:
		eveni += 1
oddj = 0
evenj = 0
for x in j:
	if x % 2 == 0:
		evenj += 1
	else:
		oddj += 1
print(min(oddj, eveni) + min(evenj, oddi))


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


def oddEven(a):
	(odd, even) = (0, 0)
	for n in a:
		if n % 2 == 0:
			even += 1
		else:
			odd += 1
	return (even, odd)
(n, m) = list(map(int, input().split(' ')))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
(ea, oa) = oddEven(a)
(eb, ob) = oddEven(b)
print(min(ea, ob) + min(oa, eb))


(n, m) = map(int, input().split())
s = input().split()
a = [int(num) for num in s]
s = input().split()
b = [int(num) for num in s]
even_chests = 0
odd_chests = 0
even_keys = 0
odd_keys = 0
for x in a:
	if x % 2 == 0:
		even_chests += 1
	else:
		odd_chests += 1
for x in b:
	if x % 2 == 0:
		even_keys += 1
	else:
		odd_keys += 1
print(min(even_chests, odd_keys) + min(odd_chests, even_keys))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, m) = M()
l = L()
k = L()
(c0, c1, k0, k1) = (0, 0, 0, 0)
for i in range(n):
	if l[i] % 2 == 0:
		c0 += 1
	else:
		c1 += 1
for i in range(m):
	if k[i] % 2 == 0:
		k0 += 1
	else:
		k1 += 1
print(min(c0, k1) + min(c1, k0))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
acnt = [0, 0]
for x in a:
	acnt[x % 2] += 1
bcnt = [0, 0]
for x in b:
	bcnt[x % 2] += 1
print(min(acnt[0], bcnt[1]) + min(acnt[1], bcnt[0]))


L1 = input()
L2 = input()
L3 = input()
L1 = L1.split()
n = L1[0]
m = L1[1]
L2 = L2.split()
L3 = L3.split()
oddChests = []
for x in L2:
	if int(x) % 2 == 1:
		oddChests.append(int(x))
oddKeys = []
for x in L3:
	if int(x) % 2 == 1:
		oddKeys.append(int(x))
numberOddChests = len(oddChests)
numberEvenChests = len(L2) - numberOddChests
numberOddKeys = len(oddKeys)
numberEvenKeys = len(L3) - len(oddKeys)
respuesta = min(numberOddChests, numberEvenKeys) + min(numberEvenChests, numberOddKeys)
print(respuesta)


(m, n) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ar = 0
br = 0
for i in a:
	if i % 2 == 1:
		ar += 1
for j in b:
	if j % 2 == 0:
		br += 1
print(min(ar, br) + min(abs(m - ar), abs(n - br)))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e1 = 0
o1 = 0
e2 = 0
o2 = 0
for i in a:
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for i in b:
	if i % 2 == 0:
		e2 += 1
	else:
		o2 += 1
print(min(e1, o2) + min(e2, o1))


(n, m) = map(int, input().split())
a = [int(e) % 2 for e in input().split()]
b = [int(e) % 2 for e in input().split()]
a1 = sum(a)
a0 = n - a1
b1 = sum(b)
b0 = m - b1
print(min(a1, b0) + min(a0, b1))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
chet_a = 0
nech_a = 0
chet_b = 0
nech_b = 0
for i in range(n):
	if a[i] % 2 == 0:
		chet_a += 1
	else:
		nech_a += 1
for i in range(m):
	if b[i] % 2 == 0:
		chet_b += 1
	else:
		nech_b += 1
print(min(chet_a, nech_b) + min(nech_a, chet_b))


line = input().split()
N = int(line[0])
M = int(line[1])
chests = [0, 0]
keys = [0, 0]
line = input().split()
for i in range(N):
	chests[int(line[i]) % 2] += 1
line = input().split()
for i in range(M):
	keys[int(line[i]) % 2] += 1
print(min(chests[0], keys[1]) + min(chests[1], keys[0]))


(n, m) = map(int, input().split())
odd = even = cnt = 0
chests = list(map(int, input().split()))
for i in range(0, len(chests)):
	if chests[i] % 2 == 0:
		even += 1
	else:
		odd += 1
keys = list(map(int, input().split()))
for i in range(0, len(keys)):
	if keys[i] % 2 == 0:
		if odd > 0:
			odd -= 1
			cnt += 1
	elif even > 0:
		even -= 1
		cnt += 1
print(cnt)


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


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A0 = [a for a in A if a % 2 == 0]
A1 = [a for a in A if a % 2 == 1]
B0 = [a for a in B if a % 2 == 0]
B1 = [a for a in B if a % 2 == 1]
print(min(len(A0), len(B1)) + min(len(A1), len(B0)))


nm = [int(c) for c in input().split()]
na = [int(c) for c in input().split()]
mb = [int(c) for c in input().split()]
(mona, momb) = (0, 0)
for i in range(nm[0]):
	if na[i] % 2 == 1:
		mona += 1
for i in range(nm[1]):
	if mb[i] % 2 == 1:
		momb += 1
s = min(nm[0] - mona, momb) + min(nm[1] - momb, mona)
print(s)


(n, m) = map(int, input().split())
chests = [1 if w % 2 else 0 for w in [int(x) for x in input().split()]]
keys = [1 if w % 2 else 0 for w in [int(x) for x in input().split()]]
print(min([chests.count(1), keys.count(0)]) + min([chests.count(0), keys.count(1)]))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
od1 = 0
ev1 = 0
od2 = 0
ev2 = 0
for i in a:
	if i % 2 == 1:
		od1 += 1
	else:
		ev1 += 1
for i in b:
	if i % 2 == 1:
		od2 += 1
	else:
		ev2 += 1
print(min(od2, ev1) + min(ev2, od1))


(n, m) = [int(x) for x in input().split()]
ns = [int(x) for x in input().split()]
ms = [int(x) for x in input().split()]
ns = [x % 2 for x in ns]
ms = [x % 2 for x in ms]
ns = [sum(ns), n - sum(ns)]
ms = [sum(ms), m - sum(ms)]
print(min(ns[0], ms[1]) + min(ns[1], ms[0]))


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
d = list(map(int, input().split()))
(a, b, x, y) = (0, 0, 0, 0)
for i in l:
	if i % 2 == 0:
		x = x + 1
	else:
		y += 1
for j in d:
	if j % 2 == 0:
		a = a + 1
	else:
		b = b + 1
s = min(x, b) + min(y, a)
print(s)


import sys
input = sys.stdin.readline
(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))

def count_odd(l):
	cnt = 0
	for i in l:
		if i % 2 == 1:
			cnt += 1
	return cnt
odd_chests = count_odd(chests)
even_chests = len(chests) - odd_chests
odd_keys = count_odd(keys)
even_keys = len(keys) - odd_keys
print(min(odd_chests, even_keys) + min(even_chests, odd_keys))


(a, b) = list(map(int, input().split()))
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
c = 0
for i in range(a):
	if l[i] % 2 == 0:
		c = c + 1
e = c
o = a - e
c = 0
for i in range(b):
	if l1[i] % 2 == 0:
		c = c + 1
e1 = c
o1 = b - e1
s = 0
s = s + min(e, o1)
s = s + min(o, e1)
print(s)


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


from sys import *
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
(e1, o1, e2, o2) = (0, 0, 0, 0)
for i in A:
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for j in B:
	if j % 2 == 0:
		e2 += 1
	else:
		o2 += 1
stdout.write(str(min(e1, o2) + min(e2, o1)) + '\n')


(o, p) = input().split()
c = input().split()
d = input().split()
k = 0
n = 0
for i in c:
	if int(i) % 2 == 1:
		n += 1
for i in d:
	if int(i) % 2 == 1:
		k += 1
print(min([min([int(p) - k, n]) + min([int(o) - n, k])]))


(n, m) = input().split()
n = int(n)
m = int(m)
a = []
b = []
inp = input().split()
for i in inp:
	a.append(int(i))
inp = input().split()
for i in inp:
	b.append(int(i))
e1 = 0
for i in a:
	if i % 2 == 0:
		e1 += 1
o1 = n - e1
e2 = 0
for i in b:
	if i % 2 == 0:
		e2 += 1
o2 = m - e2
print(min(e1, o2) + min(e2, o1))


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

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


(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
x = 0
y = 0
for c in a:
	if c % 2 == 0:
		x += 1
	else:
		y += 1
x1 = 0
y1 = 0
for c in b:
	if c % 2 == 0:
		x1 += 1
	else:
		y1 += 1
print(min(x, y1) + min(y, x1))


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = len([x for x in a if x % 2 == 0])
a2 = len(a) - a1
b1 = len([x for x in b if x % 2 == 0])
b2 = len(b) - b1
sol = 0
x = min(a2, b1)
sol += x
a2 -= x
b1 -= x
x = min(a1, b2)
sol += x
a1 -= x
b2 -= x
print(sol)


(n, m) = map(int, input().strip().split())
L1 = list(map(int, input().strip().split()))
L2 = list(map(int, input().strip().split()))
even1 = 0
odd1 = 0
for i in L1:
	if i % 2 != 0:
		odd1 += 1
	else:
		even1 += 1
even_2 = 0
odd_2 = 0
for i in L2:
	if i % 2 != 0:
		odd_2 += 1
	else:
		even_2 += 1
print(min(even1, odd_2) + min(even_2, odd1))


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


(chests, keys) = input().split()
chests = int(chests)
keys = int(keys)
chest = [] * chests
key = [] * keys
chest[0:chests - 1] = input().split()
key[0:keys - 1] = input().split()
counter1 = 0
counter2 = 0
counter3 = 0
counter4 = 0
for i1 in range(1, chests + 1):
	if int(chest[i1 - 1]) % 2 != 0:
		counter1 = counter1 + 1
for i2 in range(1, keys + 1):
	if int(key[i2 - 1]) % 2 == 0:
		counter2 = counter2 + 1
comp1 = [counter1, counter2]
result1 = min(comp1)
for i3 in range(1, chests + 1):
	if int(chest[i3 - 1]) % 2 == 0:
		counter3 = counter3 + 1
for i4 in range(1, keys + 1):
	if int(key[i4 - 1]) % 2 != 0:
		counter4 = counter4 + 1
comp2 = [counter3, counter4]
result2 = min(comp2)
result = result1 + result2
print(result)


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a = list(map(lambda x: x % 2, a))
b = list(map(lambda x: x % 2, b))
a = sorted(a)
b = sorted(b)[::-1]
cnt = min(a.count(1), b.count(0)) + min(a.count(0), b.count(1))
print(cnt)


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


(a, b) = map(int, input().split())
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
n_E = len(list(filter(lambda x: x % 2 == 0, keys)))
n1_E = len(list(filter(lambda x: x % 2 == 0, chest)))
n_O = len(keys) - n_E
n1_O = len(chest) - n1_E
print(min(n_O, n1_E) + min(n_E, n1_O))


(s, k) = map(int, input().split())
su = list(map(int, input().split()))
sch = []
snch = []
kl = list(map(int, input().split()))
kch = []
knch = []
for i in su:
	if i % 2 == 0:
		sch.append(i)
	else:
		snch.append(i)
for i in kl:
	if i % 2 == 0:
		kch.append(i)
	else:
		knch.append(i)
summ = 0
summ += min(len(kch), len(snch))
summ += min(len(knch), len(sch))
print(summ)


import os
import sys
from io import BytesIO, IOBase
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, k) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
c = 0
c1 = 0
c2 = 0
c3 = 0
for i in range(n):
	if l[i] % 2 == 0:
		c += 1
	else:
		c1 += 1
for i in range(k):
	if l1[i] % 2 == 0:
		c2 += 1
	else:
		c3 += 1
ans = min(c2, c1) + min(c, c3)
print(ans)


(n, m) = list(map(int, input().split()))
chestOdd = chestEven = keyOdd = keyEven = 0
for num in list(map(int, input().split())):
	if num % 2:
		chestOdd = chestOdd + 1
	else:
		chestEven = chestEven + 1
for num in list(map(int, input().split())):
	if num % 2:
		keyOdd = keyOdd + 1
	else:
		keyEven = keyEven + 1
print(min(chestOdd, keyEven) + min(chestEven, keyOdd))


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


(n, m) = map(int, input().split())
s = list(map(int, input().split()))
s1 = list(map(int, input().split()))
countse = 0
countso = 0
counts1e = 0
counts1o = 0
for i in range(n):
	if s[i] % 2 == 0:
		countse += 1
	else:
		countso += 1
for i in range(m):
	if s1[i] % 2 == 0:
		counts1e += 1
	else:
		counts1o += 1
p = min(countso, counts1e)
q = min(countse, counts1o)
print(p + q)


from sys import stdin
(n, m) = map(int, stdin.readline().split())
cst = list(map(int, stdin.readline().split()))
ke = list(map(int, stdin.readline().split()))
a = list(filter(lambda x: x % 2 == 0, cst))
ae = len(a)
ao = n - ae
b = list(filter(lambda x: x % 2 == 0, ke))
be = len(b)
bo = m - be
print(min(ae, bo) + min(be, ao))


(a, b) = map(int, input().split())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
(even, odd) = (0, 0)
(even1, odd1) = (0, 0)
for i in range(a):
	if aa[i] % 2 == 0:
		even += 1
	else:
		odd += 1
for j in range(b):
	if bb[j] % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
print(min(even, odd1) + min(even1, odd))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ec = 0
ek = 0
oc = 0
ok = 0
for i in a:
	if i % 2 == 0:
		ec += 1
	else:
		oc += 1
for i in b:
	if i % 2 == 0:
		ek += 1
	else:
		ok += 1
print(min(ec, ok) + min(oc, ek))


from collections import Counter
(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c1 = Counter(map(lambda x: x % 2, a))
c2 = Counter(map(lambda x: x % 2, b))
print(min(c1[1], c2[0]) + min(c1[0], c2[1]))


from collections import Counter
counterk = Counter()
counterc = Counter()
(n, m) = list(map(int, input().split()))
k = list(map(int, input().split()))
c = list(map(int, input().split()))
for num in k:
	counterk[num % 2] += 1
for num in c:
	counterc[num % 2] += 1
result = 0
x = counterk[0]
if counterc[1] < x:
	x = counterc[1]
result += x
x = counterk[1]
if counterc[0] < x:
	x = counterc[0]
result += x
print(result)


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


(n, m) = map(int, input().split())
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
oa = len(list(filter(lambda x: x % 2 == 1, al)))
ob = len(list(filter(lambda x: x % 2 == 1, bl)))
print(min(oa, m - ob) + min(ob, n - oa))


import math
import collections
(n, m) = map(int, input().split())
a = map(int, input().split())
b = map(int, input().split())
(odd1, even1) = (0, 0)
for num in a:
	if num % 2:
		odd1 += 1
	else:
		even1 += 1
(odd2, even2) = (0, 0)
for num in b:
	if num % 2:
		odd2 += 1
	else:
		even2 += 1
print(min(odd1, even2) + min(odd2, even1))


(x, y) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
p = q = r = s = 0
for i in a:
	if i % 2 != 0:
		p += 1
	else:
		q += 1
for i in b:
	if i % 2 != 0:
		r += 1
	else:
		s += 1
print(min(p, s) + min(q, r))


def rahul(a):
	(r, e, o) = (0, 0, 0)
	while r < len(a):
		if a[r] % 2 == 0:
			e = e + 1
		else:
			o = o + 1
		r = r + 1
	return (e, o)
input()
a = [int(a) for a in input().split()]
b = [int(b) for b in input().split()]
(ae, ao) = rahul(a)
(be, bo) = rahul(b)
s = 0
print(min(ae, bo) + min(ao, be))


(n, m) = map(int, input().split())
ch = list(map(int, input().split()))
ke = list(map(int, input().split()))
oddk = []
evlk = []
och = []
ech = []
for i in range(len(ke)):
	if ke[i] % 2 == 0:
		evlk.append(ke[i])
	else:
		oddk.append(ke[i])
for i in ch:
	if i % 2 == 0:
		ech.append(i)
	else:
		och.append(i)
print(min(len(och), len(evlk)) + min(len(ech), len(oddk)))


(n, m) = [int(i) for i in input().split(' ')]
A = [int(i) for i in input().split(' ')]
B = [int(i) for i in input().split(' ')]
a = [0, 0]
b = [0, 0]
for i in A:
	a[i & 1] += 1
for i in B:
	b[i & 1] += 1
print(min(a[0], b[1]) + min(a[1], b[0]))


(n, m) = list(map(int, input().split()))
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))

def get_even(nums):
	ans = {'even': 0}
	for n in nums:
		if n % 2 == 0:
			ans['even'] += 1
	return ans

def get_odd(nums):
	ans = {'odd': 0}
	for n in nums:
		if n % 2 != 0:
			ans['odd'] += 1
	return ans
chest_even = get_even(chest)
chest_odd = get_odd(chest)
keys_even = get_even(keys)
keys_odd = get_odd(keys)
pairs = 0
while chest_even['even'] > 0 and keys_odd['odd'] > 0:
	pairs += 1
	chest_even['even'] -= 1
	keys_odd['odd'] -= 1
while chest_odd['odd'] > 0 and keys_even['even'] > 0:
	pairs += 1
	chest_odd['odd'] -= 1
	keys_even['even'] -= 1
print(pairs)


def evenCount(p):
	i = 0
	e = 0
	for i in range(0, len(p)):
		if p[i] % 2 == 0:
			e += 1
	return e
(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e1 = evenCount(a)
o1 = n - e1
e2 = evenCount(b)
o2 = k - e2
count = 0
if e1 <= o2:
	count += e1
else:
	count += o2
if e2 <= o1:
	count += e2
else:
	count += o1
print(count)


(treasure_num, keys_num) = [int(treasure) for treasure in input().split(' ')]
treasure = list(map(int, input().split(' ')))
keys = list(map(int, input().split(' ')))
c0 = 0
c1 = 0
k0 = 0
k1 = 0
for i in treasure:
	if i % 2 != 0:
		c0 += 1
	else:
		c1 += 1
for i in keys:
	if i % 2 != 0:
		k0 += 1
	else:
		k1 += 1
total = min(c0, k1) + min(c1, k0)
print(total)


I = lambda : map(int, input().split())
(n, m) = I()
x = sum((a % 2 for a in I()))
y = sum((b % 2 for b in I()))
print(min(x, m - y) + min(y, n - x))


input()
s = list(map(int, input().split()))
evenchests = 0
oddchests = 0
for i in s:
	if i % 2 == 0:
		evenchests = evenchests + 1
	else:
		oddchests = oddchests + 1
s = list(map(int, input().split()))
evenkeys = 0
oddkeys = 0
for i in s:
	if i % 2 == 0:
		evenkeys = evenkeys + 1
	else:
		oddkeys = oddkeys + 1
c = 0
if evenkeys >= oddchests:
	c = c + oddchests
else:
	c = c + evenkeys
if oddkeys >= evenchests:
	c = c + evenchests
else:
	c = c + oddkeys
print(c)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(q, s, d, f) = (0, 0, 0, 0)
for i in a:
	if i % 2 == 0:
		q += 1
	else:
		s += 1
for i in b:
	if i % 2 == 0:
		d += 1
	else:
		f += 1
print(min(q, f) + min(s, d))


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
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 [int(x) for x in sys.stdin.readline().split()]

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

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

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

def S():
	return input()

def main():
	(n, m) = LI()
	a = LI()
	b = LI()
	x1 = y1 = 0
	for x in a:
		if x % 2 == 0:
			x1 += 1
	for y in b:
		if y % 2 == 0:
			y1 += 1
	x2 = len(a) - x1
	y2 = len(b) - y1
	return min(x1, y2) + min(x2, y1)
print(main())


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
e1 = 0
e2 = 0
o1 = 0
o2 = 0
for i in range(n):
	if A[i] % 2 == 1:
		o1 += 1
	else:
		e1 += 1
for i in range(m):
	if B[i] % 2 == 1:
		o2 += 1
	else:
		e2 += 1
ans = min(o1, e2) + min(o2, e1)
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
chest_even = 0
chest_odd = 0
key_even = 0
key_odd = 0
for i in range(n):
	if a[i] % 2 != 0:
		chest_odd += 1
	else:
		chest_even += 1
for i in range(m):
	if b[i] % 2 != 0:
		key_odd += 1
	else:
		key_even += 1
x = min(chest_even, key_odd) + min(chest_odd, key_even)
print(x)


(a, b) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
k1 = k2 = 0
v1 = v2 = 0
for i in range(a):
	if A[i] % 2 == 1:
		k1 += 1
	else:
		k2 += 1
for i in range(b):
	if B[i] % 2 == 1:
		v1 += 1
	else:
		v2 += 1
print(min(k1, v2) + min(k2, v1))


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


(a, b) = input().split()
a = int(a)
b = int(b)
l = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
le = 0
re = 0
lo = 0
ro = 0
for i in l:
	if i % 2 == 0:
		le += 1
	else:
		lo += 1
for i in r:
	if i % 2 == 0:
		re += 1
	else:
		ro += 1
print(min(ro, le) + min(lo, re))


(n, m) = [int(s) for s in input().split(' ')]
a = [int(s) for s in input().split(' ')]
b = [int(s) for s in input().split(' ')]
a_odds = sum([x % 2 for x in a])
b_odds = sum([y % 2 for y in b])
print(min(a_odds, m - b_odds) + min(n - a_odds, b_odds))


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


(n, m) = list(map(lambda x: int(x), input().split()))
Ai = list(map(lambda x: int(x), input().split()))
Bi = list(map(lambda x: int(x), input().split()))
Astats = [0, 0]
Bstats = [0, 0]
for i in Ai:
	if i % 2 == 0:
		Astats[1] += 1
	else:
		Astats[0] += 1
for i in Bi:
	if i % 2 == 0:
		Bstats[1] += 1
	else:
		Bstats[0] += 1
print(min(Astats[1], Bstats[0]) + min(Astats[0], Bstats[1]))


(n, m) = map(int, input().split())
c = list([int(x) for x in input().split()])[:n]
k = list([int(y) for y in input().split()])[:m]
s = []
c1 = 0
c2 = 0
for i in c:
	if i % 2 == 0:
		c1 += 1
	else:
		c2 += 1
k1 = 0
k2 = 0
for j in k:
	if j % 2 == 0:
		k1 += 1
	else:
		k2 += 1
z = min(k2, c1) + min(c2, k1)
print(z)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
odda = 0
oddb = 0
evena = 0
evenb = 0
for i in a:
	if i % 2 == 0:
		evena += 1
	else:
		odda += 1
for i in b:
	if i % 2 == 0:
		evenb += 1
	else:
		oddb += 1
first = min(evena, oddb)
sec = min(evenb, odda)
print(first + sec)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count1 = 0
count2 = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		count1 += 1
count2 = len(a) - count1
count3 = 0
count4 = 0
for i in range(len(b)):
	if b[i] % 2 != 0:
		count3 += 1
count4 = len(b) - count3
ans = min(count1, count3) + min(count2, count4)
print(ans)


for _ in range(1):
	(n, m) = map(int, input().split())
	lsta = list(map(int, input().split()))
	lstb = list(map(int, input().split()))
	odd1 = 0
	even1 = 0
	odd2 = 0
	even2 = 0
	for i in lsta:
		if i % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in lstb:
		if i % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	x1 = min(odd1, even2)
	x2 = min(odd2, even1)
	print(x1 + x2)


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
odd_chest = 0
even_chest = 0
odd_key = 0
even_key = 0
for i in range(len(chest)):
	if chest[i] % 2 == 0:
		even_chest += 1
	else:
		odd_chest += 1
for i in range(len(key)):
	if key[i] % 2 == 0:
		even_key += 1
	else:
		odd_key += 1
print(min(even_chest, odd_key) + min(odd_chest, even_key))


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
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, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kodd = 0
keven = 0
lodd = 0
leven = 0
for i in a:
	if i % 2 == 1:
		lodd += 1
	else:
		leven += 1
for i in b:
	if i % 2 == 1:
		kodd += 1
	else:
		keven += 1
r = min(kodd, leven) + min(keven, lodd)
print(r)


(n, x) = map(int, input().split())
lis1 = [int(i) for i in input().split()]
lis2 = [int(i) for i in input().split()]
odd1 = 0
odd2 = 0
for i in lis1:
	if i % 2 == 1:
		odd1 += 1
for i in lis2:
	if i % 2 == 1:
		odd2 += 1
even1 = n - odd1
even2 = x - odd2
print(min(odd1, even2) + min(odd2, even1))


(n, m) = map(int, input().split())
s = input().split()
a = [int(num) for num in s]
z = input().split()
b = [int(num) for num in z]
x = 0
y = 0
t = 0
g = 0
p = 0
for i in a:
	if i % 2 == 1:
		x += 1
	elif i % 2 == 0:
		y += 1
for i in b:
	if i % 2 == 1:
		t += 1
	elif i % 2 == 0:
		g += 1
if x <= g:
	p += x
elif x > g:
	p += g
if y <= t:
	p += y
elif y > t:
	p += t
print(p)


input()
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
chestOdd = chestEven = 0
keyOdd = keyEven = 0
for num in chest:
	if num & 1 == 1:
		chestOdd += 1
	else:
		chestEven += 1
for num in key:
	if num & 1 == 1:
		keyOdd += 1
	else:
		keyEven += 1
print(min(chestOdd, keyEven) + min(chestEven, keyOdd))


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
o = e = s = o1 = e1 = 0
for i in range(n):
	if l1[i] % 2 == 0:
		e += 1
	else:
		o += 1
for i in range(m):
	if l2[i] % 2 == 0:
		e1 += 1
	else:
		o1 += 1
if o1 < e:
	s += o1
else:
	s += e
if e1 < o:
	s += e1
else:
	s += o
print(s)


__version__ = '0.1'
__date__ = '2019-04-24'
import sys
import string

def solve(n, m, a, b):
	(a_even, a_odd) = (0, 0)
	for ai in a:
		if ai % 2 == 0:
			a_even += 1
		else:
			a_odd += 1
	(b_even, b_odd) = (0, 0)
	for bi in b:
		if bi % 2 == 0:
			b_even += 1
		else:
			b_odd += 1
	return min(a_odd, b_even) + min(a_even, b_odd)

def main(argv=None):
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	print(solve(n, m, a, b))
	return 0
STATUS = main()
sys.exit(STATUS)


(c, k) = list(map(int, input().split()))
t = list(map(int, input().split()))
s = list(map(int, input().split()))
u = []
v = []
(z, q, m, n) = (0, 0, 0, 0)
for i in t:
	if i % 2 == 0:
		z += 1
	else:
		q += 1
u.append(z)
v.append(q)
for k in s:
	if k % 2 == 0:
		m += 1
	else:
		n += 1
u.append(n)
v.append(m)
print(min(u) + min(v))


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
oddA = 0
evenA = 0
for i in a:
	if i % 2:
		oddA += 1
	else:
		evenA += 1
oddB = 0
evenB = 0
for i in b:
	if i % 2:
		oddB += 1
	else:
		evenB += 1
print(min(oddA, evenB) + min(oddB, evenA))


(n, m) = list(map(int, input().split()))
l = list(map(int, input().split()))
a = list(map(int, input().split()))
chl = 0
nechl = 0
cr = 0
necr = 0
for i in range(n):
	if l[i] % 2 == 0:
		chl += 1
	else:
		nechl += 1
for i in range(m):
	if a[i] % 2 == 0:
		cr += 1
	else:
		necr += 1
print(min(chl, necr) + min(nechl, cr))


arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
chests = [int(i) % 2 for i in input().split()]
keys = [int(i) % 2 for i in input().split()]
m1c = sum(chests)
m0c = n - m1c
m1k = sum(keys)
m0k = m - m1k
result = min(m1c, m0k) + min(m1k, m0c)
print(result)


(n, m) = map(int, input().split())
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
(A, B, C, D) = (0, 0, 0, 0)
for i in a:
	if i % 2 == 0:
		A += 1
	else:
		B += 1
for i in b:
	if i % 2 == 0:
		C += 1
	else:
		D += 1
print(min(A, D) + min(B, C))


(n, m) = list(map(int, input().split(' ')))
(chests, keys) = (list(map(int, input().split(' '))), list(map(int, input().split(' '))))
(cnt, cnt_odd, cnt_even) = (0, 0, 0)
for j in range(m):
	if keys[j] % 2 == 0:
		cnt_even += 1
	else:
		cnt_odd += 1
for i in range(n):
	if chests[i] % 2 == 0 and cnt_odd > 0:
		cnt += 1
		cnt_odd -= 1
	elif chests[i] % 2 != 0 and cnt_even > 0:
		cnt += 1
		cnt_even -= 1
print(cnt)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
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, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(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 res(ans, t):
	print('Case #{}: {}'.format(t, ans))
(n, m) = numIN()
a = arrIN()
b = arrIN()
e1 = e2 = 0
o1 = o2 = 0
for i in a:
	if i % 2:
		o1 += 1
	else:
		e1 += 1
for i in b:
	if i % 2:
		o2 += 1
	else:
		e2 += 1
print(min(o1, e2) + min(e1, o2))


(n, m) = map(int, input().split(' '))
arr1 = list(map(int, input().split(' ')))
arr2 = list(map(int, input().split(' ')))
even1 = 0
odd1 = 0
even2 = 0
odd2 = 0
s = 0
for val in arr1:
	if val % 2 == 0:
		even1 = even1 + 1
	else:
		odd1 = odd1 + 1
for val in arr2:
	if val % 2 == 0:
		even2 = even2 + 1
	else:
		odd2 = odd2 + 1
if even1 < odd2:
	s = s + even1
else:
	s = s + odd2
if even2 < odd1:
	s = s + even2
else:
	s = s + odd1
print(s)


input()
chests = map(int, input().split())
keys = map(int, input().split())
chestsOdd = 0
chestsEven = 0
keyOdd = 0
keyEven = 0
for i in chests:
	if i % 2 == 0:
		chestsEven += 1
	else:
		chestsOdd += 1
for i in keys:
	if i % 2 == 0:
		keyEven += 1
	else:
		keyOdd += 1
print(min(chestsEven, keyOdd) + min(chestsOdd, keyEven))


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
arr1 = list(map(int, input().split()))
odd_arr = []
even_arr = []
odd_arr1 = []
even_arr1 = []
for i in arr:
	if i % 2 == 0:
		even_arr.append(i)
	else:
		odd_arr.append(i)
for i in arr1:
	if i % 2 == 0:
		even_arr1.append(i)
	else:
		odd_arr1.append(i)
print(min(len(odd_arr), len(even_arr1)) + min(len(even_arr), len(odd_arr1)))


def odd_even():
	(odd, even) = (0, 0)
	for el in map(int, input().split()):
		if el % 2:
			even += 1
		else:
			odd += 1
	return (odd, even)
(n, m) = map(int, input().split())
(a_odd, a_even) = odd_even()
(b_odd, b_even) = odd_even()
print(min(a_odd, b_even) + min(a_even, b_odd))


def parities(data):
	res = [0, 0]
	for v in data:
		res[v % 2] += 1
	return res
(n, m) = map(int, input().split())
p1 = parities(map(int, input().split()))
p2 = parities(map(int, input().split()))
print(min(p1[0], p2[1]) + min(p1[1], p2[0]))


(n, m) = input().split()
n = int(n)
m = int(m)
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
count_chest_odd = 0
for no in A:
	if no % 2 != 0:
		count_chest_odd += 1
count_key_odd = 0
for no in B:
	if no % 2 != 0:
		count_key_odd += 1
ans = min(count_chest_odd, m - count_key_odd) + min(n - count_chest_odd, count_key_odd)
print(ans)


input()
(oddKeys, evenKeys, oddChests, evenChests) = (0, 0, 0, 0)
for a in input().split():
	if int(a) % 2 == 0:
		evenChests += 1
	else:
		oddChests += 1
for b in input().split():
	if int(b) % 2 == 0:
		evenKeys += 1
	else:
		oddKeys += 1
print(min(oddKeys, evenChests) + min(oddChests, evenKeys))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
cod = 0
kod = 0
koe = 0
coe = 0
for i in a:
	if i % 2 == 1:
		cod += 1
	else:
		coe += 1
for i in b:
	if i % 2 == 1:
		kod += 1
	else:
		koe += 1
value1 = min(cod, koe)
value = min(coe, kod)
print(value1 + value)


(n, m) = list(map(int, input().split()))
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
odd = 0
even = 0
t = 0
v = 0
for chest in chests:
	if chest % 2 == 0:
		t += 1
	else:
		v += 1
for key in keys:
	if key % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, t) + min(even, v))


input()
c = list(map(int, input().split()))
d = list(map(int, input().split()))
(cf, cz, df, dz) = (0, 0, 0, 0)
for i in c:
	if i % 2 == 0:
		cz += 1
	else:
		cf += 1
for j in d:
	if j % 2 == 0:
		dz += 1
	else:
		df += 1
print(min(cz, df) + min(cf, dz))


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


(n, m) = map(int, input().split())
ai = list(map(int, input().split()))
bi = list(map(int, input().split()))
(c0, c1) = (len([i for i in ai if i % 2 == 0]), len([i for i in ai if i % 2 != 0]))
(k0, k1) = (len([i for i in bi if i % 2 == 0]), len([i for i in bi if i % 2 != 0]))
print(min(c0, k1) + min(c1, k0))


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
chestNum = [0, 0]
keyNum = [0, 0]
ans = 0
for v in chest:
	if v & 1:
		chestNum[0] += 1
	else:
		chestNum[1] += 1
for v in key:
	if v & 1:
		keyNum[0] += 1
	else:
		keyNum[1] += 1
ans += min(chestNum[0], keyNum[1])
ans += min(chestNum[1], keyNum[0])
print(ans)


input()
a = list((int(v) & 1 for v in input().split()))
b = list((int(v) & 1 for v in input().split()))
print(min(a.count(0), b.count(1)) + min(a.count(1), b.count(0)))


(n, m) = map(int, input().split(' '))
llaves = list(map(int, input().split(' ')))
cofres = list(map(int, input().split(' ')))
ConLlaPar = 0
ConLlaImpar = 0
ConCofPar = 0
ConCofImpar = 0
for num in llaves:
	if num % 2 == 0:
		ConLlaPar += 1
	else:
		ConLlaImpar += 1
for num in cofres:
	if num % 2 == 0:
		ConCofPar += 1
	else:
		ConCofImpar += 1
minimo1 = min(ConLlaPar, ConCofImpar)
minimo2 = min(ConLlaImpar, ConCofPar)
print(minimo1 + minimo2)


(n, m) = map(int, input().split())
chests = [int(x) for x in input().split()]
keys = [int(x) for x in input().split()]

def number_even_odd(list_):
	even = 0
	for elem in list_:
		if elem % 2 == 0:
			even = even + 1
	return (even, len(list_) - even)
(chest_even, chest_odd) = number_even_odd(chests)
(keys_even, keys_odd) = number_even_odd(keys)
print(min(chest_even, keys_odd) + min(chest_odd, keys_even))


def solve(n, m, a, b):
	even = 0
	odd = 0
	for chest in a:
		if chest % 2 == 1:
			odd += 1
		else:
			even += 1
	key_even = 0
	key_odd = 0
	for key in b:
		if key % 2 == 1:
			key_odd += 1
		else:
			key_even += 1
	return min(odd, key_even) + min(even, key_odd)
(n, m) = (int(p) for p in input().split())
a = [int(p) for p in input().split()]
b = [int(p) for p in input().split()]
print(solve(n, m, a, b))


(n, m) = input().split()
chests1 = [int(el) for el in input().split()]
keys1 = [int(el) for el in input().split()]

def solution(chests, keys):

	def count_odds(arr):
		odds = [el for el in arr if el % 2 == 0]
		return (len(odds), len(arr) - len(odds))
	(k, l1) = count_odds(chests)
	(p, r) = count_odds(keys)
	return min(k, r) + min(p, l1)
print(solution(chests1, keys1))


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


(n, m) = input().split()
(chest_odd, chest_even, keys_odd, key_even) = (0, 0, 0, 0)
for i in map(int, input().split()):
	if i % 2 == 0:
		chest_even += 1
	else:
		chest_odd += 1
for i in map(int, input().split()):
	if i % 2 == 0:
		key_even += 1
	else:
		keys_odd += 1
print(min(chest_even, keys_odd) + min(chest_odd, key_even))


def mod3(list):
	return [i % 2 for i in list]
(n, m) = map(int, input().split())
A = mod3(list(map(int, input().split())))
B = mod3(list(map(int, input().split())))
oa = A.count(1)
ob = B.count(1)
ea = A.count(0)
eb = B.count(0)
print(min(oa, eb) + min(ea, ob))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count1 = [0] * 2
count2 = [0] * 2
for x in a:
	count1[x % 2] += 1
for x in b:
	count2[x % 2] += 1
print(min(count1[0], count2[1]) + min(count1[1], count2[0]))


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


(n, m) = map(int, input().split())
ai = list(map(int, input().split()))
bi = list(map(int, input().split()))
even1 = [i for i in ai if i % 2 == 0]
even2 = [i for i in bi if i % 2 == 0]
odd1 = [i for i in ai if i % 2 != 0]
odd2 = [i for i in bi if i % 2 != 0]
print(min(len(even2), len(odd1)) + min(len(odd2), len(even1)))


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
chestOdd = 0
chestEven = 0
keyOdd = 0
keyEven = 0
for i in chest:
	if i % 2 == 0:
		chestEven += 1
	else:
		chestOdd += 1
for i in key:
	if i % 2 == 0:
		keyEven += 1
	else:
		keyOdd += 1
res = min(chestOdd, keyEven) + min(chestEven, keyOdd)
print(res)


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ao = []
ae = []
bo = []
be = []
for i in a:
	if i % 2 == 0:
		ae.append(i)
	else:
		ao.append(i)
for i in b:
	if i % 2 == 0:
		be.append(i)
	else:
		bo.append(i)
k = 0
k = min(len(ao), len(be))
k = k + min(len(ae), len(bo))
print(k)


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		m = self.next_int()
		x = len([x for x in filter(lambda d: d % 2 == 0, [self.next_int() for _ in range(0, n)])])
		y = len([x for x in filter(lambda d: d % 2 == 0, [self.next_int() for _ in range(0, m)])])
		print(min(x, m - y) + min(n - x, y))
Main().solve()


def open_max_chest(num_chest, num_keys, chest, keys):
	chest_even = 0
	keys_even = 0
	total = 0
	for x in chest:
		if x % 2 == 0:
			chest_even += 1
	for y in keys:
		if y % 2 == 0:
			keys_even += 1
	keys_odd = num_keys - keys_even
	chest_odd = num_chest - chest_even
	if keys_odd > chest_even:
		total += chest_even
	else:
		total += keys_odd
	if keys_even > chest_odd:
		total += chest_odd
	else:
		total += keys_even
	return total
(num_chest, num_keys) = list(map(int, input().split()))
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
print(open_max_chest(num_chest, num_keys, chest, keys))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
oddA = 0
evenA = 0
oddB = 0
evenB = 0
for numA in a:
	if numA % 2 == 0:
		evenA += 1
	else:
		oddA += 1
for numB in b:
	if numB % 2 == 0:
		evenB += 1
	else:
		oddB += 1
print(min(oddA, evenB) + min(evenA, oddB))


from math import *
(n, m) = list(map(int, input().split(' ')))
ne1 = 0
no1 = 0
me1 = 0
mo1 = 0
li = list(map(int, input().split(' ')))
li2 = list(map(int, input().split(' ')))
for j in li:
	if j % 2 == 0:
		ne1 += 1
	else:
		no1 += 1
for k in li2:
	if k % 2 == 0:
		me1 += 1
	else:
		mo1 += 1
ans = min(ne1, mo1) + min(no1, me1)
print(ans)


(a, b) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(ev1, ev2, odd1, odd2) = (0, 0, 0, 0)
for x in l1:
	if x & 1:
		odd1 += 1
	else:
		ev1 += 1
for x in l2:
	if x & 1:
		odd2 += 1
	else:
		ev2 += 1
ans = min(ev1, odd2)
ans += min(ev2, odd1)
print(ans)


(n, m) = list(map(int, input().split()))
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
ch_chet = 0
ch_nechet = 0
ke_chet = 0
ke_nechet = 0
for c in chests:
	if c % 2 == 0:
		ch_chet += 1
ch_nechet = len(chests) - ch_chet
for c in keys:
	if c % 2 == 0:
		ke_chet += 1
ke_nechet = len(keys) - ke_chet
print(min(ch_chet, ke_nechet) + min(ch_nechet, ke_chet))


(n, m) = [int(x) for x in input().split()]
list1 = [int(x) for x in input().split()]
list2 = [int(x) for x in input().split()]
oddcount1 = len([x for x in list1 if x % 2 == 1])
evencount1 = n - oddcount1
oddcount2 = len([x for x in list2 if x % 2 == 1])
evencount2 = m - oddcount2
print(min(oddcount1, evencount2) + min(oddcount2, evencount1))


(n, m) = input().split()
chests = list(map(int, input().split(' ')))
keys = list(map(int, input().split(' ')))
lenodd = len([i for i in chests if i % 2 == 1])
leneven = len([i for i in chests if i % 2 == 0])
ans = 0
for k in keys:
	if k % 2 == 0 and lenodd != 0:
		ans += 1
		lenodd -= 1
	elif k % 2 == 1 and leneven != 0:
		ans += 1
		leneven -= 1
print(ans)


(num_chests, num_keys) = [int(val) for val in input().split()]
chests = [int(val) for val in input().split()]
keys = [int(val) for val in input().split()]
x = min(len([val for val in chests if val % 2 == 1]), len([val for val in keys if val % 2 == 0]))
y = min(len([val for val in chests if val % 2 == 0]), len([val for val in keys if val % 2 == 1]))
print(x + y)


(n, k) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
(e1, e2) = (0, 0)
(o1, o2) = (0, 0)
for i in l1:
	if i % 2 == 1:
		e1 += 1
	else:
		o1 += 1
for j in l2:
	if j % 2 == 1:
		e2 += 1
	else:
		o2 += 1
print(min(e2, o1) + min(e1, o2))


(n, m) = input().split(' ')
(n, m) = (int(n), int(m))
c = list(map(int, input().rstrip().split()))
k = list(map(int, input().rstrip().split()))
(oc, ec, ek, ok) = (0, 0, 0, 0)
for i in c:
	if i % 2 == 0:
		ec += 1
	else:
		oc += 1
for j in k:
	if j % 2 == 0:
		ek += 1
	else:
		ok += 1
print(min(ec, ok) + min(oc, ek))


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
ll = list(map(int, input().split()))
c1 = 0
c2 = 0
c3 = 0
c4 = 0
for i in l:
	if i % 2 == 0:
		c1 += 1
	else:
		c2 += 1
for i in ll:
	if i % 2 != 0:
		c3 += 1
	else:
		c4 += 1
print(min(c1, c3) + min(c2, c4))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
ans = 0
odd_l = 0
even_l = 0
odd_m = 0
even_m = 0
for i in range(len(l)):
	if l[i] % 2 == 1:
		odd_l += 1
	else:
		even_l += 1
for i in range(len(m)):
	if m[i] % 2 == 1:
		odd_m += 1
	else:
		even_m += 1
print(min(odd_l, even_m) + min(even_l, odd_m))


import sys
import math
import bisect

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


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


(m, n) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
anelyg = 0
alyg = 0
bnelyg = 0
blyg = 0
for i in a:
	if i % 2 == 1:
		anelyg = anelyg + 1
	else:
		alyg = alyg + 1
for j in b:
	if j % 2 == 1:
		bnelyg = bnelyg + 1
	else:
		blyg = blyg + 1
print(min(anelyg, blyg) + min(alyg, bnelyg))


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


(n, m) = map(int, input().split())
A = list(map(int, input().split(' ')[:n]))
B = list(map(int, input().split(' ')[:m]))
Aev = Bev = 0
for i in A:
	if i % 2 == 0:
		Aev += 1
for i in B:
	if i % 2 == 0:
		Bev += 1
print(min(Aev, abs(Bev - m)) + min(abs(Aev - n), Bev))


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


(n, m) = map(int, input().split())
lis1 = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
e1 = o1 = e2 = o2 = 0
for i in lis1:
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for i in lis2:
	if i % 2 == 0:
		e2 += 1
	else:
		o2 += 1
ans = min(e1, o2) + min(o1, e2)
print(ans)


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


(x, y) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
pa = 0
da = 0
for i in a:
	if i % 2 == 0:
		pa += 1
	else:
		da += 1
db = 0
pb = 0
for i in b:
	if i % 2 == 0:
		pb += 1
	else:
		db += 1
print('{}'.format(min(pa, db) + min(da, pb)))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(odd_a, even_a) = (0, 0)
(odd_b, even_b) = (0, 0)
for item in a:
	if item % 2 == 0:
		even_a += 1
	else:
		odd_a += 1
for item in b:
	if item % 2 == 0:
		even_b += 1
	else:
		odd_b += 1
ans = min(even_a, odd_b) + min(odd_a, even_b)
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum = [0, 0]
ans = 0
for i in range(0, n):
	sum[a[i] & 1] += 1
for i in range(0, m):
	if sum[~b[i] & 1] > 0:
		sum[~b[i] & 1] -= 1
		ans += 1
print(ans)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cnt = [0, 0]
B_cnt = [0, 0]
for a in A:
	A_cnt[a % 2] += 1
for b in B:
	B_cnt[b % 2] += 1
print(min(A_cnt[0], B_cnt[1]) + min(A_cnt[1], B_cnt[0]))


(n, m) = list(map(int, input().split()))
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
even_chests = sum(((x + 1) % 2 for x in chests))
odd_chests = sum((x % 2 for x in chests))
even_keys = sum(((x + 1) % 2 for x in keys))
odd_keys = sum((x % 2 for x in keys))
print(min(even_chests, odd_keys) + min(odd_chests, even_keys))


(n, m) = list(map(int, input().split()))
ai = list(map(int, input().split()))
bi = list(map(int, input().split()))
num = 0
num2 = 0
for i in range(n):
	num += int(ai[i] % 2)
for i in range(m):
	num2 += int(bi[i] % 2)
print(min(n - num, num2) + min(num, m - num2))


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


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


R = lambda : map(int, input().split())
(n, m) = R()
p = sum(map(lambda x: x % 2, R()))
q = sum(map(lambda x: x % 2, R()))
print(min(p, m - q) + min(n - p, q))


from sys import stdin, stdout
(n, m) = [int(x) for x in stdin.readline().rstrip().split()]
chests = [int(x) for x in stdin.readline().rstrip().split()]
keys = [int(x) for x in stdin.readline().rstrip().split()]
odd_chests = 0
odd_keys = 0
even_chests = 0
even_keys = 0
for chest in chests:
	if chest % 2 == 1:
		odd_chests += 1
	else:
		even_chests += 1
for key in keys:
	if key % 2 == 1:
		odd_keys += 1
	else:
		even_keys += 1
result = min(odd_chests, even_keys)
result += min(odd_keys, even_chests)
stdout.write(str(result) + '\n')


(n, m) = [int(e) for e in input().split()]
a = [int(e) for e in input().split()]
b = [int(e) for e in input().split()]
ae = 0
ao = 0
be = 0
bo = 0
for i in a:
	if i % 2 == 0:
		ae += 1
	else:
		ao += 1
for i in b:
	if i % 2 == 0:
		be += 1
	else:
		bo += 1
print(min(ae, bo) + min(ao, be))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
chetn = list((i for i in a if i % 2 == 0))
nechetn = list((i for i in a if i % 2 != 0))
chetm = list((i for i in b if i % 2 == 0))
nechetm = list((i for i in b if i % 2 != 0))
print(min(len(chetn), len(nechetm)) + min(len(chetm), len(nechetn)))


def fun(chest, key):
	(odd1, even1) = (0, 0)
	for i in range(n):
		if chest[i] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	(odd2, even2) = (0, 0)
	for i in range(m):
		if key[i] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	return min(odd1, even2) + min(odd2, even1)
(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
key = list(map(int, input().split()))
print(fun(chest, key))


(n, m) = map(int, input().split())
a = sum((int(ai) % 2 for ai in input().split()))
b = sum((int(bi) % 2 for bi in input().split()))
print(min(a, m - b) + min(b, n - a))


input()
(fst, snd) = (list(map(int, input().split())), list(map(int, input().split())))
(oddfst, oddsnd, evenfst, evensnd) = (0, 0, 0, 0)
for n in fst:
	if n % 2 == 0:
		evenfst += 1
	else:
		oddfst += 1
for n in snd:
	if n % 2 == 0:
		evensnd += 1
	else:
		oddsnd += 1
print(min(oddfst, evensnd) + min(evenfst, oddsnd))


n = input()
lc = [int(i) for i in input().split()]
lk = [int(i) for i in input().split()]
co = 0
ce = 0
for i in lc:
	if i % 2 == 0:
		ce += 1
	else:
		co += 1
ko = 0
ke = 0
for i in lk:
	if i % 2 == 0:
		ke += 1
	else:
		ko += 1
print(min(co, ke) + min(ce, ko))


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l = list(map(int, input().split()))
e = 0
o = 0
for i in range(n):
	if l1[i] % 2 == 0:
		e += 1
	else:
		o += 1
c = 0
for i in range(m):
	if l[i] % 2 == 0 and o != 0:
		c += 1
		o -= 1
	elif l[i] % 2 != 0 and e != 0:
		c += 1
		e -= 1
print(c)


(n, m) = map(int, input().split())
chn = list(map(int, input().split()))
kyn = list(map(int, input().split()))
o_c = 0
o_k = 0
for i in chn:
	if i % 2 != 0:
		o_c += 1
for i in kyn:
	if i % 2 != 0:
		o_k += 1
print(min(n - o_c, o_k) + min(o_c, m - o_k))


(n, m) = map(int, input().split())
a = map(int, input().split())
b = map(int, input().split())
da = [0] * 2
db = [0] * 2
for x in a:
	da[x % 2] += 1
for x in b:
	db[x % 2] += 1
ans = min(da[0], db[1]) + min(da[1], db[0])
print(ans)


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
even_in_chest = 0
odd_in_chest = 0
even_in_key = 0
odd_in_key = 0
for i in chest:
	if i % 2 == 0:
		even_in_chest += 1
	else:
		odd_in_chest += 1
for i in keys:
	if i % 2 == 0:
		even_in_key += 1
	else:
		odd_in_key += 1
res = min(odd_in_key, even_in_chest) + min(odd_in_chest, even_in_key)
print(res)


n = input()
c = list(map(int, input().split()))
k = list(map(int, input().split()))
od = 0
ev = 0
for i in c:
	if i % 2 == 0:
		ev += 1
for j in k:
	if j % 2 != 0:
		od += 1
print(min(ev, od) + min(len(c) - ev, len(k) - od))


(chests, keys) = map(int, input().split())
c_i = map(int, input().split())
k_i = map(int, input().split())
even_c = 0
ood_k = 0
for c in c_i:
	if c % 2 == 0:
		even_c += 1
for k in k_i:
	if k % 2 != 0:
		ood_k += 1
ans = min(even_c, ood_k) + min(chests - even_c, keys - ood_k)
print(ans)


(n, m) = [int(x) for x in input().split()]
(n1, n0, m1, m0) = [0] * 4
for i in [int(x) for x in input().split()]:
	if i % 2:
		n1 += 1
	else:
		n0 += 1
for i in [int(x) for x in input().split()]:
	if i % 2:
		m1 += 1
	else:
		m0 += 1
print(min(m1, n0) + min(m0, n1))


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
(n, m) = mi()
(a, b) = [li() for _ in [0, 1]]
ao = ae = bo = be = 0
for i in range(n):
	if a[i] % 2 == 1:
		ao += 1
	else:
		ae += 1
for i in range(m):
	if b[i] % 2 == 1:
		bo += 1
	else:
		be += 1
print(min(ao, be) + min(ae, bo))


(n, m) = map(int, input().split())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
(oa, ob) = (sum((1 for e in a if e & 1)), sum((1 for e in b if e & 1)))
(ea, eb) = (n - oa, m - ob)
res = min(oa, eb)
res += min(ea, ob)
print(res)


arr = input()
(M, N) = [int(x) for x in arr.split(' ')]
arr = input()
A = [int(x) for x in arr.split(' ')]
arr = input()
B = [int(x) for x in arr.split(' ')]
odd_A = 0
even_A = 0
odd_B = 0
even_B = 0
for num in A:
	if num % 2 == 0:
		even_A += 1
	else:
		odd_A += 1
for num in B:
	if num % 2 == 0:
		even_B += 1
	else:
		odd_B += 1
print(min(even_A, odd_B) + min(even_B, odd_A))


(n, m) = map(int, input().split())
a = sum((int(y) & 1 for y in input().split()))
b = sum((int(y) & 1 for y in input().split()))
print(min(a, m - b) + min(n - a, b))


def odd_no(c):
	k = 0
	for item in c:
		if item % 2 == 1:
			k = k + 1
	return k
(n, m) = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
ao = odd_no(a)
bo = odd_no(b)
ae = n - ao
be = m - bo
p1 = min(ao, be)
p2 = min(ae, bo)
print(p1 + p2)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
eA = 0
oA = 0
eB = 0
oB = 0
for i in range(n):
	if a[i] % 2 == 1:
		eA += 1
	else:
		oA += 1
for i in range(m):
	if b[i] % 2 == 1:
		eB += 1
	else:
		oB += 1
print(min(eA, oB) + min(oA, eB))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a0 = 0
a1 = 0
b0 = 0
b1 = 0
for i in range(n):
	if a[i] % 2 == 0:
		a0 += 1
	else:
		a1 += 1
for i in range(m):
	if b[i] % 2 == 0:
		b0 += 1
	else:
		b1 += 1
print(min(a0, b1) + min(a1, b0))


array = input()
array = [int(x) for x in array.split()]
(n, m) = (array[0], array[1])
array = input()
A = [int(x) for x in array.split()]
array = input()
B = [int(x) for x in array.split()]
odd_chest = 0
for i in range(n):
	if A[i] % 2 == 1:
		odd_chest += 1
odd_keys = 0
for i in range(m):
	if B[i] % 2 == 1:
		odd_keys += 1
even_chest = n - odd_chest
even_keys = m - odd_keys
first = min(even_chest, odd_keys)
second = min(even_keys, odd_chest)
print(first + second)


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


ent = input()
(n, m) = ent.split()
ent2 = input()
tesouros = ent2.split()
ent3 = input()
chaves = ent3.split()
t_par = 0
c_par = 0
for i in range(len(tesouros)):
	if int(tesouros[i]) % 2 == 0:
		t_par += 1
for i in range(len(chaves)):
	if int(chaves[i]) % 2 == 0:
		c_par += 1
dup1 = [t_par, int(m) - c_par]
dup2 = [int(n) - t_par, c_par]
print(min(dup1) + min(dup2))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n_even_a = len([x for x in a if x % 2 == 0])
n_even_b = len([x for x in b if x % 2 == 0])
n_odd_a = n - n_even_a
n_odd_b = m - n_even_b
print(min(n_even_a, n_odd_b) + min(n_odd_a, n_even_b))


(a, b) = map(int, input().split())
(s1, s2) = (list(map(int, input().split())), list(map(int, input().split())))
s1 = list(map(lambda x: x % 2, s1))
s2 = list(map(lambda x: x % 2, s2))
print(min(s1.count(1), s2.count(0)) + min(s1.count(0), s2.count(1)))


(n, m) = map(int, input().split())
a = sum(map(lambda x: int(x) % 2, input().split()))
b = sum(map(lambda x: int(x) % 2, input().split()))
print(min(n - a, b) + min(a, m - b))


(n, m) = list(map(int, input().split()))
ns = list(map(int, input().split()))
ms = list(map(int, input().split()))
odd_ns = len(list(filter(lambda x: x % 2 != 0, ns)))
even_ns = len(ns) - odd_ns
odd_ms = len(list(filter(lambda x: x % 2 != 0, ms)))
even_ms = len(ms) - odd_ms
ans = min(odd_ns, even_ms) + min(odd_ms, even_ns)
print(ans)


(s, o) = list(map(int, input().split()))
n = list(map(int, input().split()))
a = list(map(int, input().split()))
k = 0
z = 0
x = 0
y = 0
for i in n:
	if i % 2 == 0:
		k += 1
	else:
		z += 1
for j in a:
	if j % 2 == 0:
		x += 1
	else:
		y += 1
d = min(k, y)
f = min(z, x)
print(d + f)


(n, m) = map(int, input().split())
a = sum([1 for x in map(int, input().split()) if x % 2 == 0])
b = sum([1 for x in map(int, input().split()) if x % 2 == 0])
print(min(a, m - b) + min(b, n - a))


li = lambda : [*map(int, input().split())]
(n, m) = li()
(a, b) = (sum((x % 2 for x in li())) for _ in [0, 1])
print(min(a, m - b) + min(b, n - a))


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


test = [int(x) for x in input().split()]
n = test[0]
m = test[1]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
odd = 0
odd1 = 0
even = 0
even1 = 0
for i in range(n):
	if a[i] % 2 == 0:
		even += 1
	else:
		odd += 1
for i in range(m):
	if b[i] % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
print(min(odd, even1) + min(even, odd1))


(chest, key) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
(cpairs, codds, kpairs, kodds) = (0, 0, 0, 0)
for c in chests:
	if not c % 2:
		codds += 1
	else:
		cpairs += 1
for k in keys:
	if not k % 2:
		kodds += 1
	else:
		kpairs += 1
result = 0
result += min(cpairs, kodds)
result += min(codds, kpairs)
print(result)


from collections import Counter
input()

def get_list(l, invert=False):
	d = {0: 0, 1: 0}
	d.update(Counter(map(lambda x: (int(x) + invert) % 2, l.split())))
	return d
chests = get_list(input())
keys = get_list(input(), invert=True)
print(sum(map(min, zip(chests.values(), keys.values()))))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e = 0
o = 0
for i in b:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
odcount = 0
for i in a:
	if i % 2 != 0:
		odcount += 1
print(min(odcount, e) + min(len(a) - odcount, o))


(n, m) = list(map(int, input().split()))
key = list(map(int, input().split()))
chest = list(map(int, input().split()))
odd_key = []
odd_c = []
even_key = []
even_c = []
for i in range(n):
	if key[i] % 2:
		even_key.append(key[i])
	else:
		odd_key.append(key[i])
for i in range(m):
	if chest[i] % 2:
		even_c.append(chest[i])
	else:
		odd_c.append(chest[i])
print(min(len(odd_c), len(even_key)) + min(len(odd_key), len(even_c)))


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a1 = a2 = 0
b1 = b2 = 0
for i in A:
	if i % 2 == 0:
		a1 += 1
	elif i % 2 != 0:
		a2 += 1
for j in B:
	if j % 2 == 0:
		b1 += 1
	elif j % 2 != 0:
		b2 += 1
s = min(a1, b2) + min(a2, b1)
print(s)


(n, m) = map(int, input().strip().split()[:2])
t = list(map(int, input().strip().split()[:n]))
k = list(map(int, input().strip().split()[:m]))
ev1 = []
od1 = []
ev2 = []
od2 = []
for x in t:
	if x % 2 != 0:
		od1.append(x)
	else:
		ev1.append(x)
for x in k:
	if x % 2 != 0:
		od2.append(x)
	else:
		ev2.append(x)
z1 = min(len(ev1), len(od2))
z2 = min(len(ev2), len(od1))
print(z1 + z2)


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
Ao = 0
Bo = 0
for a in A:
	if a % 2 == 1:
		Ao += 1
for b in B:
	if b % 2 == 1:
		Bo += 1
Ae = n - Ao
Be = m - Bo
ans = min(Ao, Be) + min(Ae, Bo)
print(ans)


(chests, keys) = map(int, input().split())
chest_nums = list(map(int, input().split()))
key_nums = list(map(int, input().split()))
even_chest = []
odd_chest = [x if x % 2 != 0 else even_chest.append(x) for x in chest_nums]
odd_chest = [y for y in odd_chest if y is not None]
odds = len(odd_chest)
evens = len(even_chest)
for key in key_nums:
	if key % 2 != 0:
		if evens > 0:
			evens -= 1
	elif odds > 0:
		odds -= 1
print(len(even_chest) + len(odd_chest) - (odds + evens))


(n, m) = [int(x) for x in input().split()]
nc = [int(x) for x in input().split()]
nk = [int(x) for x in input().split()]
odd = 0
even = 0
co = 0
ce = 0
for e in nc:
	if e % 2 == 0:
		ce += 1
	else:
		co += 1
for e in nk:
	if e % 2 == 0:
		even += 1
	else:
		odd += 1
print(min(odd, ce) + min(even, co))


import math
import sys
import itertools
import itertools
import bisect

def sa(Type=int):
	return [Type(x) for x in input().split()]

def solve(t):
	(_, _) = sa()
	chests = sa()
	keys = sa()
	kOdds = 0
	kEvens = 0
	cOdds = 0
	cEvens = 0
	for x in chests:
		if x % 2 == 0:
			cEvens += 1
		else:
			cOdds += 1
	for x in keys:
		if x % 2 == 0:
			kEvens += 1
		else:
			kOdds += 1
	print(min(kOdds, cEvens) + min(kEvens, cOdds))
solve(1)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
t2 = 0
t1 = 0
t11 = 0
t22 = 0
for i in range(m):
	if b[i] % 2 == 1:
		t1 = t1 + 1
	else:
		t2 = t2 + 1
for j in range(n):
	if a[j] % 2 == 1:
		t11 = t11 + 1
	else:
		t22 = t22 + 1
print(min(t1, t22) + min(t2, t11))


x = input().split()
emon1 = input().split()
emon2 = input().split()
odd1 = 0
even1 = 0
odd2 = 0
even2 = 0
for i in emon1:
	if int(i) % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
for i in emon2:
	if int(i) % 2 == 0:
		even2 += 1
	else:
		odd2 += 1
m = 0
if even1 > odd2:
	m = odd2
	even1 = even1 - m
	odd2 = 0
else:
	m = even1
	odd2 = odd2 - m
	even1 = 0
c = 0
if even2 > odd1:
	c = odd1
	even2 = even2 - c
	odd1 = 0
else:
	c = even2
	odd1 = odd1 - c
	even2 = 0
print(m + c)


(n, m) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
count1 = 0
for i in range(n):
	if arr1[i] % 2 == 1:
		count1 += 1
count2 = 0
for i in range(m):
	if arr2[i] % 2 == 1:
		count2 += 1
pair1 = min(count2, n - count1)
pair2 = min(count1, m - count2)
ans = pair1 + pair2
print(ans)


(n, m) = map(int, input().split())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
(ao, ae) = (0, 0)
for ai in a:
	if ai % 2 == 0:
		ae += 1
	else:
		ao += 1
(bo, be) = (0, 0)
for bi in b:
	if bi % 2 == 0:
		be += 1
	else:
		bo += 1
ans = min(bo, ae) + min(be, ao)
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
counte1 = 0
counto1 = 0
counte2 = 0
counto2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		counte1 += 1
	else:
		counto1 += 1
for i in range(m):
	if b[i] % 2 == 0:
		counte2 += 1
	else:
		counto2 += 1
print(min(counto1, counte2) + min(counto2, counte1))


input()
chests = [int(x) for x in input().split(' ')]
keys = [int(x) for x in input().split(' ')]
evenChests = 0
oddChests = 0
evenKeys = 0
oddKeys = 0
total = 0
for chest in chests:
	if chest % 2 == 0:
		evenChests += 1
	else:
		oddChests += 1
for key in keys:
	if key % 2 == 0:
		evenKeys += 1
	else:
		oddKeys += 1
if oddKeys < evenChests:
	total += oddKeys
else:
	total += evenChests
if evenKeys < oddChests:
	total += evenKeys
else:
	total += oddChests
print(total)


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


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
(n, m) = q()
odda = len([1 for i in q() if i % 2])
evena = n - odda
oddb = len([1 for i in q() if i % 2])
evenb = m - oddb
print(min([odda, evenb]) + min([oddb, evena]))


(n_chests, n_keys) = [int(x) for x in input().split()]
chests = [int(x) for x in input().split()]
keys = [int(x) for x in input().split()]
odd_chests = sum([1 if x % 2 == 1 else 0 for x in chests])
odd_keys = sum([1 if x % 2 == 1 else 0 for x in keys])
even_chests = len(chests) - odd_chests
even_keys = len(keys) - odd_keys
total = 0
total += min(odd_chests, even_keys)
total += min(odd_keys, even_chests)
print(total)


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
h = 0
c = 0
answer = 0
for i in range(n):
	if a[i] % 2 == 0:
		h += 1
	else:
		c += 1
for i in range(m):
	if b[i] % 2 == 0:
		if c != 0:
			answer += 1
			c -= 1
	elif h != 0:
		answer += 1
		h -= 1
print(answer)


(c, k) = map(int, input().split())
chst = input()
key = input()
e1 = e2 = o1 = o2 = 0
for i in chst.split():
	if int(i) % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for j in key.split():
	if int(j) % 2 == 0:
		e2 = e2 + 1
	else:
		o2 = o2 + 1
print(min(o2, e1) + min(o1, e2))


import io
import os
from collections import defaultdict
from sys import stdin, stdout
from math import gcd

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	odd_a = 0
	even_a = 0
	for val in a:
		if val % 2 == 1:
			odd_a += 1
		else:
			even_a += 1
	odd_b = 0
	even_b = 0
	for val in b:
		if val % 2 == 1:
			odd_b += 1
		else:
			even_b += 1
	print(min(odd_a, even_b) + min(even_a, odd_b))
main()


(n, m) = [int(x) for x in str(input()).split()]
N = [int(x) for x in str(input()).split()]
M = [int(x) for x in str(input()).split()]
Nodd = 0
Neven = 0
for elem in N:
	if elem % 2 == 0:
		Neven += 1
	else:
		Nodd += 1
Modd = 0
Meven = 0
for elem in M:
	if elem % 2 == 0:
		Meven += 1
	else:
		Modd += 1
x = min(Nodd, Meven)
x += min(Modd, Neven)
print(x)


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
cnte1 = 0
cnte2 = 0
cnto1 = 0
cnto2 = 0
for i in a:
	if i % 2 == 0:
		cnte1 += 1
	else:
		cnto1 += 1
for i in b:
	if i % 2 == 0:
		cnte2 += 1
	else:
		cnto2 += 1
print(min(cnte1, cnto2) + min(cnte2, cnto1))


(n, m) = input().split()
s = input().split(' ')
k = input().split(' ')
chet1 = 0
nechet1 = 0
for i in s:
	if int(i) % 2 == 0:
		chet1 += 1
	else:
		nechet1 += 1
chet2 = 0
nechet2 = 0
for i in k:
	if int(i) % 2 == 0:
		chet2 += 1
	else:
		nechet2 += 1
print(min(chet1, nechet2) + min(chet2, nechet1))


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


a = input().split(' ')
n = int(a[0])
m = int(a[1])
box = list(map(lambda x: int(x) % 2, input().split(' ')))
key = list(map(lambda x: int(x) % 2, input().split(' ')))
table = [[0, 0], [0, 0]]
for i in box:
	if i == 1:
		table[0][1] = table[0][1] + 1
	else:
		table[0][0] = table[0][0] + 1
for i in key:
	if i == 1:
		table[1][1] = table[1][1] + 1
	else:
		table[1][0] = table[1][0] + 1
print(min(table[0][0], table[1][1]) + min(table[0][1], table[1][0]))


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


(chest_cnt, key_cnt) = [int(x) for x in input().split()]
chests = [int(x) for x in input().split() if int(x) & 1]
keys = [int(x) for x in input().split() if int(x) & 1]
odd_chests = len(chests)
even_chests = chest_cnt - odd_chests
odd_keys = len(keys)
even_keys = key_cnt - odd_keys
print(min(odd_chests, even_keys) + min(odd_keys, even_chests))


def neko_grapes(lst1, lst2):
	(c0, c1) = (0, 0)
	for i in range(len(lst1)):
		if lst1[i] % 2 == 0:
			c0 += 1
		else:
			c1 += 1
	(k0, k1) = (0, 0)
	for j in range(len(lst2)):
		if lst2[j] % 2 == 0:
			k0 += 1
		else:
			k1 += 1
	return min(c1, k0) + min(c0, k1)
(n, m) = [int(i) for i in input().split()]
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
print(neko_grapes(a, b))


(n, m) = map(int, input().split())
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))
(lne, lno, lme, lmo) = (0, 0, 0, 0)
for i in range(n):
	if ln[i] % 2 == 0:
		lne += 1
	else:
		lno += 1
for i in range(m):
	if lm[i] % 2 == 0:
		lme += 1
	else:
		lmo += 1
print(min(lne, lmo) + min(lno, lme))


(n, m) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
c1 = 0
for el in arr1:
	if el % 2 == 0:
		c1 += 1
c2 = 0
for el in arr2:
	if el % 2 == 1:
		c2 += 1
print(min(c1, c2) + min(n - c1, m - c2))


(n, m) = map(int, input().split())
a = [int(x) % 2 for x in input().split()]
b = [int(x) % 2 for x in input().split()]
(pares_a, pares_b) = (0, 0)
(impares_a, impares_b) = (0, 0)
for i in a:
	if i % 2:
		impares_a += 1
	else:
		pares_a += 1
for i in b:
	if i % 2:
		impares_b += 1
	else:
		pares_b += 1
print(min(impares_a, pares_b) + min(pares_a, impares_b))


(n, m) = (int(i) for i in input().split())
L = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
e1 = 0
e2 = 0
o1 = 0
o2 = 0
for i in L:
	if i % 2:
		o1 += 1
	else:
		e1 += 1
for i in H:
	if i % 2:
		o2 += 1
	else:
		e2 += 1
print(min(o1, e2) + min(o2, e1))


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(a_odd, a_even, b_odd, b_even) = (0, 0, 0, 0)
for x in a:
	if x % 2 == 1:
		a_odd += 1
	else:
		a_even += 1
for x in b:
	if x % 2 == 1:
		b_odd += 1
	else:
		b_even += 1
ans = min(a_odd, b_even) + min(a_even, b_odd)
print(ans)


(n, m) = map(int, input().split())
ln = list(map(int, input().split()))
lm = list(map(int, input().split()))
(o, ko) = (0, 0)
(e, ke) = (0, 0)
for i in ln:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
for i in lm:
	if i % 2 == 0:
		ke += 1
	else:
		ko += 1
print(min(o, ke) + min(e, ko))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
s = list(map(int, input().split()))
a = [q % 2 for q in a]
s = [q % 2 for q in s]
(x1, y1) = (a.count(0), s.count(0))
(x2, y2) = (n - x1, m - y1)
print(min(x2, y1) + min(x1, y2))


from sys import *
from math import *
from bisect import *
(n, k) = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
b = list(map(int, stdin.readline().split()))
e1 = e2 = 0
a1 = a2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		e1 += 1
	else:
		a1 += 1
for i in range(k):
	if b[i] % 2 == 0:
		e2 += 1
	else:
		a2 += 1
print(min(e1, a2) + min(e2, a1))


def main():
	entrada = list(map(int, input().split()))
	cofres = list(map(int, input().split()))
	llaves = list(map(int, input().split()))
	parCofres = 0
	parLlaves = 0
	for i in range(len(cofres)):
		if cofres[i] % 2 == 0:
			parCofres += 1
	for i in range(len(llaves)):
		if llaves[i] % 2 == 0:
			parLlaves += 1
	imparCofres = len(cofres) - parCofres
	imparLlaves = len(llaves) - parLlaves
	resultado = 0
	if imparLlaves <= parCofres:
		resultado += imparLlaves
	if imparLlaves > parCofres:
		resultado += parCofres
	if parLlaves <= imparCofres:
		resultado += parLlaves
	if parLlaves > imparCofres:
		resultado += imparCofres
	print(resultado)
main()


(n, m) = map(int, input().split())
chest = [int(x) for x in input().split()]
key = [int(x) for x in input().split()]
ce = co = ke = ko = 0
for i in range(n):
	if chest[i] % 2 == 0:
		ce += 1
	else:
		co += 1
for i in range(m):
	if key[i] % 2 == 0:
		ke += 1
	else:
		ko += 1
print(min(ce, ko) + min(co, ke))


(n, m) = map(int, input().split())
acounto = 0
acounte = 0
bcounto = 0
bcounte = 0
a = list(map(int, input().split()))
for at in a:
	if at % 2 == 0:
		acounte += 1
	else:
		acounto += 1
b = list(map(int, input().split()))
for bt in b:
	if bt % 2 == 0:
		bcounte += 1
	else:
		bcounto += 1
print(min(acounto, bcounte) + min(bcounto, acounte))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
evenn = 0
oddn = 0
evenm = 0
oddm = 0
for i in a:
	if i % 2 == 0:
		evenn += 1
	else:
		oddn += 1
for i in b:
	if i % 2 == 0:
		evenm += 1
	else:
		oddm += 1
print(min(evenn, oddm) + min(evenm, oddn))


(l, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
odd_l1 = 0
odd_l2 = 0
for i in range(l):
	if l1[i] % 2 != 0:
		odd_l1 += 1
for i in range(m):
	if l2[i] % 2 != 0:
		odd_l2 += 1
even_l1 = m - odd_l1
even_l2 = l - odd_l2
print(min(odd_l1, even_l2) + min(odd_l2, even_l1))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
x = 0
y = 0
x1 = 0
y1 = 0
for i in l:
	if i % 2 == 0:
		x += 1
	else:
		y += 1
for i in l1:
	if i % 2 == 0:
		x1 += 1
	else:
		y1 += 1
z = min(x, y1)
z2 = min(y, x1)
sum = z + z2
print(sum)


(n, m) = map(int, input().split())
Chest = [int(x) for x in input().split()]
Keys = [int(x) for x in input().split()]
Chest_Odd = 0
Chest_Even = 0
for i in Chest:
	if i & 1:
		Chest_Odd += 1
	else:
		Chest_Even += 1
Keys_Odd = 0
Keys_Even = 0
for i in Keys:
	if i & 1:
		Keys_Odd += 1
	else:
		Keys_Even += 1
print(min(Keys_Odd, Chest_Even) + min(Chest_Odd, Keys_Even))


from collections import deque
(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
evenChests = deque([x for x in chests if x % 2 == 0])
oddChests = deque([x for x in chests if x % 2 == 1])
cnt = 0
for k in keys:
	if k % 2 == 1:
		if evenChests:
			evenChests.pop()
			cnt += 1
	elif oddChests:
		oddChests.pop()
		cnt += 1
print(cnt)


(chest, key) = [int(x) for x in input().split()]
number_chest = [int(x) for x in input().split()]
number_key = [int(x) for x in input().split()]
chest_odd = 0
chest_even = 0
key_odd = 0
key_even = 0
for i in number_chest:
	if i % 2:
		chest_odd += 1
	else:
		chest_even += 1
for i in number_key:
	if i % 2:
		key_odd += 1
	else:
		key_even += 1
print(min(key_odd, chest_even) + min(key_even, chest_odd))


(n, m) = map(int, input().split())
ce = 0
co = 0
cco = 0
cce = 0
ni = [int(n) for n in input().split()]
mi = [int(n) for n in input().split()]
for i in range(n):
	if ni[i] % 2 == 0:
		ce += 1
	else:
		co += 1
for i in range(m):
	if mi[i] % 2 == 0:
		cce += 1
	else:
		cco += 1
print(min(ce, cco) + min(co, cce))


(n, m) = list(map(int, input().strip().split()))
t = list(map(int, input().strip().split()))
k = list(map(int, input().strip().split()))
e = 0
o = 0
for i in k:
	if i % 2 == 0:
		e += 1
	else:
		o += 1
op = 0
for i in t:
	if i % 2 == 0:
		if o > 0:
			o -= 1
			op += 1
	elif e > 0:
		e -= 1
		op += 1
print(op)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = list(map(int, input().split()))
v = 0
m = 0
l = 0
for j in c:
	if j % 2 == 1:
		v += 1
s = a - v
for i in d:
	if i % 2 == 0:
		m += 1
n = b - m
l += min(v, m)
l += min(s, n)
print(l)


(n, y) = map(int, input().split())
l = list(map(int, input().split()))
m = list(map(int, input().split()))
e1 = 0
e2 = 0
o1 = 0
o2 = 0
for x in range(0, len(l)):
	if l[x] % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for x in range(0, len(m)):
	if m[x] % 2 == 0:
		e2 += 1
	else:
		o2 += 1
print(min(o2, e1) + min(o1, e2))


from math import sqrt, ceil, floor
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import string
import bisect

def solve():
	(n, m) = map(int, stdin.readline().split())
	a = map(int, stdin.readline().split())
	b = map(int, stdin.readline().split())
	(chet, nech) = (0, 0)
	for i in a:
		if i % 2 == 0:
			chet += 1
		else:
			nech += 1
	ans = 0
	for i in b:
		if i % 2 == 0 and nech > 0:
			nech -= 1
			ans += 1
		elif i % 2 == 1 and chet > 0:
			chet -= 1
			ans += 1
	print(ans)
solve()


[n, m] = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
a1 = 0
a2 = 0
b1 = 0
b2 = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		a1 += 1
	else:
		a2 += 1
for i in range(len(b)):
	if b[i] % 2 == 0:
		b1 += 1
	else:
		b2 += 1
print(min(a1, b2) + min(a2, b1))


(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
odd1 = len([num for num in a if num % 2 != 0])
even1 = len(a) - odd1
odd2 = len([num for num in b if num % 2 != 0])
even2 = len(b) - odd2
print(min(even1, odd2) + min(odd1, even2))


def main():
	(n, m) = map(int, input().split())
	chest = list(map(int, input().split()))
	keys = list(map(int, input().split()))
	evenc = 0
	oddc = 0
	evenk = 0
	oddk = 0
	for i in chest:
		if i % 2 == 0:
			evenc += 1
		else:
			oddc += 1
	for i in keys:
		if i % 2 == 0:
			evenk += 1
		else:
			oddk += 1
	print(min(evenc, oddk) + min(oddc, evenk))
main()


def count(List):
	(even, odd) = (0, 0)
	for j in range(len(List)):
		if List[j] % 2 == 0:
			even += 1
		else:
			odd += 1
	return (even, odd)
(n, m) = [int(j) for j in input().split()]
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
(e1, o1) = count(a)
(e2, o2) = count(b)
print(min(o1, e2) + min(o2, e1))


def main():
	(n, m) = (int(x) for x in input().strip().split(' '))
	a = [int(x) for x in input().strip().split(' ')]
	b = [int(x) for x in input().strip().split(' ')]
	answer = solve(a, b)
	print(answer)

def is_odd(num):
	return num % 2 == 1

def is_even(num):
	return num % 2 == 0

def solve(a, b):
	term1 = min(len([x for x in a if is_odd(x)]), len([x for x in b if is_even(x)]))
	term2 = min(len([x for x in a if is_even(x)]), len([x for x in b if is_odd(x)]))
	return term1 + term2
main()


ab = input().split()
a = int(ab[0])
b = int(ab[1])
a_i = input().split()
b_i = input().split()
for i in range(a):
	a_i[i] = int(a_i[i])
for j in range(b):
	b_i[j] = int(b_i[j])
a_odd = 0
b_odd = 0
for i in a_i:
	if i % 2 == 1:
		a_odd = a_odd + 1
for l in b_i:
	if l % 2 == 1:
		b_odd = b_odd + 1
sums = min(a_odd, b - b_odd) + min(b_odd, a - a_odd)
print(sums)


from math import factorial, ceil, pow, sqrt, floor
from sys import stdin, stdout
from collections import defaultdict, Counter, deque
for _ in range(1):
	(n, m) = map(int, stdin.readline().split())
	l1 = list(map(int, stdin.readline().split()))
	l2 = list(map(int, stdin.readline().split()))
	o1 = e1 = 0
	for e in l1:
		if e & 1:
			o1 += 1
		else:
			e1 += 1
	o2 = e2 = 0
	for e in l2:
		if e & 1:
			o2 += 1
		else:
			e2 += 1
	print(min(e1, o2) + min(e2, o1))


(n, m) = input().split()
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
a = len(chests)
b = len(keys)
ca = 0
cb = 0
for i in range(a):
	if chests[i] % 2 == 1:
		ca += 1
for j in range(b):
	if keys[j] % 2 == 1:
		cb += 1
ra = min(ca, b - cb)
rb = min(cb, a - ca)
print(ra + rb)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
o = len([num for num in a if num % 2 == 1])
e = n - o
o1 = len([num for num in b if num % 2 == 1])
e1 = m - o1
print(min(e, o1) + min(e1, o))


input()

def get_counts(l, invert=False):
	ll = list(map(lambda x: (int(x) + invert) % 2, l.split()))
	ones = sum(ll)
	return (ones, len(ll) - ones)
chests = get_counts(input())
keys = get_counts(input(), invert=True)
print(sum(map(min, zip(chests, keys))))


(n, m) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
n = len(A)
m = len(B)
AA = [0, 0]
BB = [0, 0]
for i in A:
	AA[i % 2] += 1
for i in B:
	BB[i % 2] += 1
print(min(AA[0], BB[1]) + min(AA[1], BB[0]))


(n, m) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
oa = len([x for x in A if x % 2])
ob = len([x for x in B if x % 2])
ea = n - oa
eb = m - ob
print(min(oa, eb) + min(ob, ea))


(n, m) = [int(i) for i in input().split()]
s = [int(i) % 2 for i in input().split()]
k = [int(i) % 2 for i in input().split()]
t = 0
(evens, ods) = (0, 0)
(evenk, odk) = (0, 0)
for i in s:
	if i == 0:
		evens += 1
	else:
		ods += 1
for i in k:
	if i == 0:
		evenk += 1
	else:
		odk += 1
print(min(evens, odk) + min(ods, evenk))


(n, m) = input().split(' ')
sund = input().split(' ')
ke = input().split(' ')
sund = [0 if int(i) % 2 == 0 else 1 for i in sund]
ke = [0 if int(i) % 2 == 0 else 1 for i in ke]
nechet_sund = sum(sund)
chet_sund = len(sund) - sum(sund)
nechet_ke = sum(ke)
chet_ke = len(ke) - sum(ke)
rez = 0
if chet_sund > nechet_ke:
	rez += nechet_ke
else:
	rez += chet_sund
if nechet_sund > chet_ke:
	rez += chet_ke
else:
	rez += nechet_sund
print(rez)


[n, m] = [int(k) for k in input().split()]
A = [int(k) for k in input().split()]
B = [int(k) for k in input().split()]

def pairimpr(L):
	comptA = 0
	comptB = 0
	for k in L:
		if k % 2 == 0:
			comptA += 1
		else:
			comptB += 1
	return [comptA, comptB]
fA = pairimpr(A)
fB = pairimpr(B)
print(min(fA[0], fB[1]) + min(fA[1], fB[0]))


(n, m) = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
x_odd = 0
x_even = 0
for i in x:
	if i % 2 == 0:
		x_even += 1
	else:
		x_odd += 1
y_odd = 0
y_even = 0
for j in y:
	if j % 2 == 0:
		y_even += 1
	else:
		y_odd += 1
print(min(x_odd, y_even) + min(x_even, y_odd))


(n, m) = list((int(x) for x in input().split()))
a = sum((int(x) & 1 for x in input().split()))
b = sum((int(x) & 1 for x in input().split()))
print(min(a, m - b) + min(b, n - a))


q = input().rstrip().split(' ')
p = input().rstrip().split(' ')
r = input().rstrip().split(' ')
l = []
Q = []
D = 0
for i in range(0, len(p)):
	if int(p[i]) % 2 == 0:
		l.append(int(p[i]))
	else:
		Q.append(int(p[i]))
for i in range(0, len(r)):
	if int(r[i]) % 2 == 0:
		if len(Q) != 0:
			del Q[0]
			D += 1
	elif len(l) != 0:
		del l[0]
		D += 1
print(D)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(aodd, aeven, bodd, beven) = [0] * 4
for i in a:
	if i % 2:
		aodd += 1
aeven = n - aodd
for i in b:
	if i % 2:
		bodd += 1
beven = m - bodd
print(min(aodd, beven) + min(aeven, bodd))


(n, m) = map(int, input().split())
arr1 = list(map(int, input().split()))
for i in range(n):
	arr1[i] = arr1[i] % 2
arr2 = list(map(int, input().split()))
for i in range(m):
	arr2[i] = arr2[i] % 2
cnt1 = arr1.count(1)
cnt2 = arr2.count(1)
ans = min(cnt1, m - cnt2) + min(cnt2, n - cnt1)
print(ans)


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
ae = ao = be = bo = 0
for x in a:
	if x & 1:
		ao += 1
	else:
		ae += 1
for y in b:
	if y & 1:
		bo += 1
	else:
		be += 1
ret = min(ao, be) + min(ae, bo)
print(ret)


def main():
	(n, m) = map(int, input().split())
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	odd_a = len(list(filter(lambda x: x % 2 != 0, a)))
	odd_b = len(list(filter(lambda x: x % 2 != 0, b)))
	evna = len(a) - odd_a
	evnb = len(b) - odd_b
	ans = min(odd_a, evnb) + min(odd_b, evna)
	print(ans)
main()


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


def count(lst, mod):
	return len([i for i in lst if i % 2 == mod])
input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(min(count(a, 1), count(b, 0)) + min(count(a, 0), count(b, 1)))


I = lambda : map(int, input().split())
(n, m) = map(int, input().split())
a = [i % 2 for i in map(int, input().split())].count(1)
b = [i % 2 for i in map(int, input().split())].count(1)
x = min(a, m - b) + min(b, n - a)
print(x)


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


(ceven, codd, keven, kodd) = (0, 0, 0, 0)
(n, m) = map(int, input().split())
c = list(map(int, input().split()))
k = list(map(int, input().split()))
for i in c:
	if i % 2 == 0:
		ceven += 1
	else:
		codd += 1
for i in k:
	if i % 2 == 0:
		keven += 1
	else:
		kodd += 1
print(min(ceven, kodd) + min(codd, keven))


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

def ev(i):
	return i % 2 == 0
a = list(filter(ev, list(map(int, input().split()))))
b = list(filter(ev, list(map(int, input().split()))))
x = len(a)
y = n - x
r = len(b)
s = m - r
print(min(x, s) + min(y, r))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [x % 2 for x in a]
d = [y % 2 for y in b]
c_odd = sum(c)
c_even = n - c_odd
d_odd = sum(d)
d_even = m - d_odd
print(min(c_odd, d_even) + min(d_odd, c_even))


info = [int(x) for x in input().split()]
cofres = [int(x) for x in input().split()]
llaves = [int(x) for x in input().split()]
cp = 0
ci = 0
lp = 0
li = 0
for i in cofres:
	if i % 2 == 0:
		cp += 1
	else:
		ci += 1
for i in llaves:
	if i % 2 == 0:
		lp += 1
	else:
		li += 1
mp = min(ci, lp)
mi = min(cp, li)
print(mp + mi)


(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
odds = [sum((1 if i & 1 else 0 for i in a)), sum((1 if i & 1 else 0 for i in b))]
print(min(odds[0], m - odds[1]) + min(n - odds[0], odds[1]))


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


(n, m) = list(map(int, input().split()))
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
even_chest = 0
odd_chest = 0
even_keys = 0
odd_keys = 0
for i in range(n):
	if chest[i] % 2 == 0:
		even_chest += 1
	else:
		odd_chest += 1
for j in range(m):
	if keys[j] % 2 == 0:
		even_keys += 1
	else:
		odd_keys += 1
ans = 0
if even_keys <= odd_chest:
	ans += even_keys
else:
	ans += odd_chest
if odd_keys <= even_chest:
	ans += odd_keys
else:
	ans += even_chest
print(ans)


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
even1 = 0
odd1 = 0
even2 = 0
odd2 = 0
for i in l1:
	if i % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
for i in l2:
	if i % 2 == 0:
		even2 += 1
	else:
		odd2 += 1
print(min(even1, odd2) + min(even2, odd1))


count = 0
(n, m) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
odd1 = 0
even1 = 0
odd2 = 0
even2 = 0
for i in arr1:
	if i % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
for i in arr2:
	if i % 2 == 0:
		even2 += 1
	else:
		odd2 += 1
print(min(even1, odd2) + min(even2, odd1))


(n, k) = list(map(int, input().split(' ')))
chests = [int(x) for x in input().split(' ')]
keys = [int(x) for x in input().split(' ')]
(oddChests, oddKeys) = (0, 0)
for i in chests:
	if i % 2 == 0:
		oddChests += 1
for j in keys:
	if j % 2 == 0:
		oddKeys += 1
ans = min(oddKeys, len(chests) - oddChests) + min(oddChests, len(keys) - oddKeys)
print(ans)


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


(a, b) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
even1 = odd1 = even2 = odd2 = 0
for i in A:
	if i % 2 == 0:
		even1 += 1
	else:
		odd1 += 1
for i in B:
	if i % 2 == 0:
		even2 += 1
	else:
		odd2 += 1
print(min(odd1, even2) + min(odd2, even1))


(a, b) = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = 0
d = 0
for i in A:
	if i % 2 == 0:
		c += 1
for i in B:
	if i % 2 == 0:
		d += 1
print(min(c, len(B) - d) + min(d, len(A) - c))


i = input().split()
a = int(i[0])
b = int(i[1])
chest = [1 for i in input().split() if int(i) % 2 == 0]
key = [1 for i in input().split() if int(i) % 2 == 0]
even_chest = len(chest)
even_key = len(key)
odd_chest = a - even_chest
odd_key = b - even_key
possible = min(even_chest, odd_key) + min(even_key, odd_chest)
print(possible)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
e1 = 0
e2 = 0
o1 = 0
o2 = 0
count = 0
for i in range(max(n, m)):
	if i < n:
		if a[i] % 2 == 0:
			e1 += 1
		else:
			o1 += 1
	if i < m:
		if b[i] % 2 == 0:
			e2 += 1
		else:
			o2 += 1
if e1 >= o2:
	count += o2
else:
	count += e1
if o1 >= e2:
	count += e2
else:
	count += o1
print(count)


(n, m) = map(int, input().split())
l1 = list(map(int, input().strip().split()))[:n]
l2 = list(map(int, input().strip().split()))[:m]
c0 = 0
c1 = 0
k0 = 0
k1 = 0
for i in range(n):
	if l1[i] % 2 == 0:
		c0 = c0 + 1
	else:
		c1 = c1 + 1
for j in range(m):
	if l2[j] % 2 == 0:
		k0 = k0 + 1
	else:
		k1 = k1 + 1
ans = min(c1, k0) + min(c0, k1)
print(ans)


(n, m) = map(int, input().split())
chests = [int(i) for i in input().split()]
keys = [int(i) for i in input().split()]
out = 0
ch0 = 0
ch1 = 0
k1 = 0
k0 = 0
for j in range(n):
	if chests[j] % 2 == 0:
		ch0 += 1
	else:
		ch1 += 1
for i in range(m):
	if keys[i] % 2 == 0:
		k0 += 1
	else:
		k1 += 1
print(min(ch0, k1) + min(ch1, k0))


from sys import stdin, stdout, maxsize
import math
from copy import deepcopy
from collections import defaultdict
import heapq

def get_even_odd(marr):
	even = []
	odd = []
	for i in marr:
		if i % 2:
			odd.append(i)
		else:
			even.append(i)
	return (even, odd)
(n, m) = list(map(int, stdin.readline().split()))
narr = list(map(int, stdin.readline().split()))
marr = list(map(int, stdin.readline().split()))
(even, odd) = get_even_odd(marr)
i = 0
j = 0
k = 0
count = 0
while i < n and j < len(even):
	if narr[i] % 2 == 1:
		count += 1
		j += 1
	i += 1
i = 0
while i < n and k < len(odd):
	if narr[i] % 2 == 0:
		count += 1
		k += 1
	i += 1
print(count)


(l, n) = list(map(int, input().split()))
m = list(map(int, input().split()))
k = list(map(int, input().split()))
e1 = 0
e2 = 0
o1 = 0
o2 = 0
p = 0
for i in m:
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for j in k:
	if j % 2 == 0:
		e2 += 1
	else:
		o2 += 1
if o2 <= e1:
	p = p + o2
else:
	p = p + e1
if e2 <= o1:
	p = p + e2
else:
	p += o1
print(p)


(a, b) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
e1 = 0
o1 = 0
e2 = 0
o2 = 0
for i in range(0, len(c)):
	if c[i] % 2 == 0:
		e1 = e1 + 1
	else:
		o1 = o1 + 1
for i in range(0, len(d)):
	if d[i] % 2 == 0:
		e2 = e2 + 1
	else:
		o2 = o2 + 1
e = min(e1, o2)
f = min(e2, o1)
print(e + f)


[n, m] = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
oa = 0
ob = 0
ea = 0
eb = 0
for x in range(len(a)):
	if a[x] % 2 != 0:
		oa += 1
	else:
		ea += 1
for y in range(len(b)):
	if b[y] % 2 != 0:
		ob += 1
	else:
		eb += 1
print(min(oa, eb) + min(ea, ob))


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


(chests, keys) = input().split()
chest_numbers = input().split()
keys_numbers = input().split()
number = 0
odd_chests = 0
even_keys = 0
for i in chest_numbers:
	test_chest = int(i) % 2
	if test_chest == 1:
		odd_chests = odd_chests + 1
for j in keys_numbers:
	test_key = int(j) % 2
	if test_key == 0:
		even_keys = even_keys + 1
even_chests = int(chests) - odd_chests
odd_keys = int(keys) - even_keys
lis1 = [even_keys, odd_chests]
lis2 = [odd_keys, even_chests]
print(min(lis1) + min(lis2))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = sum((i & 1 for i in a))
d = sum((i & 1 for i in b))
print(min(c, m - d) + min(n - c, d))


from sys import stdin
(n, m) = map(int, stdin.readline().split())
l = list(map(int, stdin.readline().split()))
k = list(map(int, stdin.readline().split()))
(c1, c2, c3, c4) = (0, 0, 0, 0)
for i in range(n):
	if l[i] % 2 != 0:
		c1 += 1
	else:
		c2 += 1
for i in range(m):
	if k[i] % 2 != 0:
		c3 += 1
	else:
		c4 += 1
print(min(c1, c4) + min(c2, c3))


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


(n, k) = map(int, input().split())
c = list(map(int, input().split()))
key = list(map(int, input().split()))
count = 0
plus = 0
t = 0
p = 0
for i in range(n):
	if c[i] % 2 == 0:
		count += 1
	else:
		plus += 1
for j in range(k):
	if key[j] % 2 == 0:
		t += 1
	else:
		p += 1
y = min(plus, t)
z = min(count, p)
print(z + y)


[n, m] = [int(x) for x in input().split()]
c = 0
C = sorted([int(x) % 2 for x in input().split()])
K = sorted([int(x) % 2 for x in input().split()])
print(min(C.count(0), K.count(1)) + min(C.count(1), K.count(0)))


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


def I():
	return map(int, input().split())
(n, m) = I()
a = sum((i % 2 for i in list(I())))
b = sum((i % 2 for i in list(I())))
print(min(a, m - b) + min(n - a, b))


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
(ea, oa, eb, ob) = [0] * 4
for i in a:
	if i % 2 == 0:
		ea += 1
	else:
		oa += 1
for i in b:
	if i % 2 == 0:
		eb += 1
	else:
		ob += 1
print(min(ea, ob) + min(oa, eb))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(c, d) = ([0, 0], [0, 0])
for item in a:
	if item % 2 == 0:
		c[0] += 1
	else:
		c[1] += 1
for item in b:
	if item % 2 == 0:
		d[0] += 1
	else:
		d[1] += 1
num_of_chest = min(d[0], c[1]) + min(d[1], c[0])
print(num_of_chest)


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
(c_own, c_even) = (0, 0)
(k_own, k_even) = (0, 0)
for x in chest:
	if x % 2 == 0:
		c_own += 1
	else:
		c_even += 1
for x in keys:
	if x % 2 == 0:
		k_own += 1
	else:
		k_even += 1
total = min(c_own, k_even) + min(c_even, k_own)
result = min(total, n)
print(result)


a = [int(x) for x in input().split()]
ChestList = [int(x) for x in input().split()]
KeyList = [int(x) for x in input().split()]
OddNumChest = 0
EvenNumChest = 0
OddNumKey = 0
EvenNumKey = 0
ans1 = 0
ans2 = 0
for i in range(0, len(ChestList)):
	if ChestList[i] % 2 == 0:
		EvenNumChest += 1
	else:
		OddNumChest += 1
for i in range(0, len(KeyList)):
	if KeyList[i] % 2 == 0:
		EvenNumKey += 1
	else:
		OddNumKey += 1
if EvenNumChest == OddNumKey:
	ans1 = EvenNumChest
elif EvenNumChest > OddNumKey:
	ans1 = OddNumKey
else:
	ans1 = EvenNumChest
if OddNumChest == EvenNumKey:
	ans2 = OddNumChest
elif OddNumChest > EvenNumKey:
	ans2 = EvenNumKey
else:
	ans2 = OddNumChest
print(ans1 + ans2)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	(n, m) = map(int, sys.stdin.readline().split(' '))
	a = list(map(int, sys.stdin.readline().split(' ')))
	b = list(map(int, sys.stdin.readline().split(' ')))
	ae = 0
	ao = 0
	be = 0
	bo = 0
	for i in range(m):
		if b[i] % 2:
			bo += 1
		else:
			be += 1
	for i in range(n):
		if a[i] % 2:
			ao += 1
		else:
			ae += 1
	print(min(ao, be) + min(ae, bo))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


(m, n) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
e1 = o1 = e2 = o2 = 0
for c in a:
	if c % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for d in b:
	if d % 2 == 0:
		e2 += 1
	else:
		o2 += 1
print(min(o1, e2) + min(o2, e1))


(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
oddChests = len(list(filter(lambda x: x % 2 == 1, chests)))
evenChests = n - oddChests
oddKeys = len(list(filter(lambda x: x % 2 == 1, keys)))
evenKeys = m - oddKeys
print(min(oddChests, evenKeys) + min(evenChests, oddKeys))


import sys
import collections
from math import floor, ceil, log2
inp = lambda : sys.stdin.readline().strip()
(n, m) = map(int, inp().split())
o1 = 0
e1 = 0
o2 = 0
e2 = 0
for i in list(map(int, inp().split())):
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for i in list(map(int, inp().split())):
	if i % 2 == 0:
		e2 += 1
	else:
		o2 += 1
print(min(e1, o2) + min(o1, e2))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = list(filter(lambda x: x % 2 == 1, a))
y = list(filter(lambda x: x % 2 == 0, a))
i = list(filter(lambda x: x % 2 == 1, b))
j = list(filter(lambda x: x % 2 == 0, b))
r1 = min(len(x), len(j))
r2 = min(len(y), len(i))
print(r1 + r2)


import math
s = input()
(n, m) = s.split(' ')
n = int(n)
m = int(m)
e_chest = 0
o_chest = 0
e_key = 0
o_key = 0
l_chest = input()
l_chest = l_chest.split()
l_key = input()
l_key = l_key.split()
for i in range(n):
	if int(l_chest[i]) % 2 == 1:
		o_chest += 1
	else:
		e_chest += 1
for i in range(m):
	if int(l_key[i]) % 2 == 1:
		o_key += 1
	else:
		e_key += 1
ans = min(e_chest, o_key) + min(e_key, o_chest)
print(ans)


import sys
import math
input = sys.stdin.readline
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
brr = list(map(int, input().split()))
oda = 0
eva = 0
odb = 0
evb = 0
for i in range(n):
	if arr[i] % 2:
		oda += 1
	else:
		eva += 1
for i in range(m):
	if brr[i] % 2:
		odb += 1
	else:
		evb += 1
ans = 0
ans += min(oda, evb)
ans += min(eva, odb)
print(ans)


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
moda = [i % 2 for i in a]
modb = [j % 2 for j in b]
ans = min(moda.count(0), modb.count(1)) + min(moda.count(1), modb.count(0))
print(ans)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007
yp = 0

def solve():
	t = 1
	for tt in range(t):
		(n, m) = num()
		a = li()
		b = li()
		x = 0
		y = 0
		p = 0
		q = 0
		for i in range(n):
			if a[i] % 2 == 0:
				x += 1
			else:
				y += 1
		for i in range(m):
			if b[i] % 2 == 0:
				p += 1
			else:
				q += 1
		print(min(x, q) + min(y, p))
solve()


(n, m) = map(int, input().split())
a = [int(v) for v in input().split()]
b = [int(v) for v in input().split()]
e1 = o1 = e2 = o2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		e1 = e1 + 1
	else:
		o1 = o1 + 1
for j in range(m):
	if b[j] % 2 == 0:
		e2 = e2 + 1
	else:
		o2 = o2 + 1
print(min(e1, o2) + min(o1, e2))


def main():
	s = [int(x) for x in input().split()]
	n = s[0]
	m = s[1]
	odd1 = 0
	even1 = 0
	odd2 = 0
	even2 = 0
	s1 = [int(x) for x in input().split()]
	s2 = [int(x) for x in input().split()]
	for i in range(n):
		if s1[i] % 2 == 0:
			even1 += 1
		else:
			odd1 += 1
	for i in range(m):
		if s2[i] % 2 == 0:
			even2 += 1
		else:
			odd2 += 1
	ans = min(odd1, even2) + min(odd2, even1)
	print(ans)
main()


(n, m) = map(int, input().split())
a = [int(j) for j in input().split()]
b = [int(j) for j in input().split()]
(ec, oc) = (0, 0)
(ek, ok) = (0, 0)
for x in a:
	if x % 2 == 1:
		oc += 1
	else:
		ec += 1
for x in b:
	if x % 2 == 1:
		ok += 1
	else:
		ek += 1
print(min(oc, ek) + min(ec, ok))


n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
even_numbers_a = len([i for i in a if i % 2 == 0])
odd_numbers_a = len([i for i in a if i % 2 == 1])
even_numbers_b = len([i for i in b if i % 2 == 0])
odd_numbers_b = len([i for i in b if i % 2 == 1])
count = 0
count = count + min(even_numbers_a, odd_numbers_b)
count = count + min(odd_numbers_a, even_numbers_b)
print(count)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ao = sum((1 for i in a if i % 2 == 1))
ae = len(a) - ao
bo = sum((1 for i in b if i % 2 == 1))
be = len(b) - bo
print(min(ao, be) + min(ae, bo))


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
o = 0
e = 0
for i in a:
	if i & 1 == 0:
		e += 1
	else:
		o += 1
o_ = 0
e_ = 0
for i in b:
	if i & 1 == 0:
		e_ += 1
	else:
		o_ += 1
print(min(o, e_) + min(e, o_))


a = list(map(int, input().split()))
n = list(map(int, input().split()))
m = list(map(int, input().split()))
p = len([i for i in n if i % 2 == 0])
q = len(n) - p
r = len([i for i in m if i % 2 == 0])
s = len(m) - r
print(min(p, s) + min(q, r))


input()
keys = list(map(int, input().split(' ')))
chests = list(map(int, input().split(' ')))
key_odd = 0
for i in keys:
	if i & 1 == 0:
		key_odd += 1
key_even = len(keys) - key_odd
chest_odd = 0
for i in chests:
	if i & 1 == 0:
		chest_odd += 1
chest_even = len(chests) - chest_odd
print(min(key_even, chest_odd) + min(key_odd, chest_even))


(key, chest) = map(int, input().split())
chestArr = list(map(int, input().split()))
keyArr = list(map(int, input().split()))
evenChest = 0
evenArr = 0
oddChest = 0
oddArr = 0
total = 0
for i in chestArr:
	if i % 2 == 0:
		evenChest += 1
	else:
		oddChest += 1
for j in keyArr:
	if j % 2 == 0:
		evenArr += 1
	else:
		oddArr += 1
total = min(evenChest, oddArr) + min(evenArr, oddChest)
print(total)


(n, m) = [int(i) for i in input().split(' ')]
nn = [int(i) for i in input().split(' ')]
mm = [int(i) for i in input().split(' ')]
nn_o = sum((1 for i in nn if i % 2 == 1))
nn_e = sum((1 for i in nn if i % 2 == 0))
mm_o = sum((1 for i in mm if i % 2 == 1))
mm_e = sum((1 for i in mm if i % 2 == 0))
print(min(nn_o, mm_e) + min(nn_e, mm_o))


(n, m) = map(int, input().split())
la = [int(i) for i in input().split()]
lb = [int(i) for i in input().split()]
(ae, ao, be, bo) = (0, 0, 0, 0)
for i in la:
	if i % 2 == 0:
		ae += 1
	else:
		ao += 1
for i in lb:
	if i % 2 == 0:
		be += 1
	else:
		bo += 1
print(min(ae, bo) + min(ao, be))


(n, m) = map(int, input().split())
sAll = list(map(int, input().split()))
kAll = list(map(int, input().split()))
s1 = len(list(filter(lambda x: x % 2 == 0, sAll)))
s2 = len(list(filter(lambda x: x % 2 == 1, sAll)))
k1 = len(list(filter(lambda x: x % 2 == 0, kAll)))
k2 = len(list(filter(lambda x: x % 2 == 1, kAll)))
result = min(s1, k2) + min(s2, k1)
print(result)


from sys import stdin, stdout
write = stdout.write
stdin.readline()
chests = [int(i) for i in stdin.readline().strip().split()]
keys = [int(i) for i in stdin.readline().strip().split()]
ic = pc = ck = pk = 0
for i in chests:
	if i % 2 == 0:
		pc += 1
	else:
		ic += 1
for i in keys:
	if i % 2 == 0:
		pk += 1
	else:
		ck += 1
print(min(pc, ck) + min(ic, pk))


(n, m) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
even_in_chests = 0
odd_in_chests = 0
even_in_keys = 0
odd_in_keys = 0
for i in range(n):
	if a[i] % 2 == 0:
		even_in_chests += 1
	else:
		odd_in_chests += 1
for i in range(m):
	if b[i] % 2 == 0:
		even_in_keys += 1
	else:
		odd_in_keys += 1
print(min(even_in_chests, odd_in_keys) + min(odd_in_chests, even_in_keys))


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


(c, k) = map(int, input().split())
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
chest.sort()
keys.sort()
(even_c, odd_c) = (0, 0)
(even, odd) = (0, 0)
for i in range(c):
	if chest[i] % 2 != 0:
		odd_c += 1
	else:
		even_c += 1
for j in range(k):
	if keys[j] % 2 != 0:
		odd += 1
	else:
		even += 1
print(min(odd, even_c) + min(even, odd_c))


user_input = input().split(' ')
opera = [int(x.strip()) for x in user_input]
n = input().split(' ')
op = [int(x.strip()) for x in n]
a = input().split(' ')
kp = [int(x.strip()) for x in a]
c0 = len(list(filter(lambda varX: varX % 2 == 0, op)))
k0 = len(list(filter(lambda varX: varX % 2 == 0, kp)))
c1 = len(list(filter(lambda varX: varX % 2 == 1, op)))
k1 = len(list(filter(lambda varX: varX % 2 == 1, kp)))
count = min(c0, k1) + min(c1, k0)
print(count)


line1 = input().split()
n = int(line1[0])
m = int(line1[1])
arrN = list(map(int, input().split()))
arrM = list(map(int, input().split()))
arrN0 = len(list(filter(lambda elm: elm % 2 == 0, arrN)))
arrN1 = len(arrN) - arrN0
arrM0 = len(list(filter(lambda elm: elm % 2 == 0, arrM)))
arrM1 = len(arrM) - arrM0
print(min(arrN0, arrM1) + min(arrM0, arrN1))


(n, m) = map(int, input().split())
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
(x, y) = ([], [])
(x1, y1) = ([], [])
for i in range(n):
	if lst1[i] % 2 == 0:
		x.append(lst1[i])
	else:
		y.append(lst1[i])
for i in range(m):
	if lst2[i] % 2 == 0:
		x1.append(lst2[i])
	else:
		y1.append(lst2[i])
(X, Y) = (len(x), len(y))
(X1, Y1) = (len(x1), len(y1))
ans1 = min(X, Y1)
ans2 = min(Y, X1)
print(ans1 + ans2)


(N1, N2) = map(int, input().split())
L1 = list(map(int, input().split()))
L2 = list(map(int, input().split()))
(EVEN1, EVEN2, ODD1, ODD2) = (0, 0, 0, 0)
for i in L1:
	if i % 2 == 0:
		EVEN1 += 1
	else:
		ODD1 += 1
for j in L2:
	if j % 2 == 0:
		EVEN2 += 1
	else:
		ODD2 += 1
print(min(EVEN2, ODD1) + min(EVEN1, ODD2))


import collections
import random
import heapq
import bisect
import math
import time

class Solution2:

	def solve(self, A1, A2):
		pass

class Solution:

	def solve(self, chests, keys):
		return min(len([c for c in chests if c % 2]), len([k for k in keys if k % 2 == 0])) + min(len([c for c in chests if c % 2 == 0]), len([k for k in keys if k % 2]))
sol = Solution()
sol2 = Solution2()
for test_case in range(1):
	(N, M) = input().split()
	a = [int(c) for c in input().split()]
	b = [int(c) for c in input().split()]
	out = sol.solve(a, b)
	print(str(out))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ev = 0
od = 0
cnt = 0
for v in a:
	if v % 2 == 0:
		ev += 1
	else:
		od += 1
for i in range(m):
	if b[i] % 2 == 0 and od > 0:
		od -= 1
		cnt += 1
	elif b[i] % 2 == 1 and ev > 0:
		ev -= 1
		cnt += 1
print(cnt)


(a, b) = map(int, input().split())
m = list(map(int, input().split()))
n = list(map(int, input().split()))
(q, w, e, r) = (0, 0, 0, 0)
for i in m:
	if i % 2 != 0:
		q += 1
e = a - q
for j in n:
	if j % 2 == 0:
		w += 1
r = b - w
print(min(q, w) + min(e, r))


import collections

def solve():
	(N, M) = map(int, input().split())
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	A = [a % 2 for a in A]
	B = [b % 2 for b in B]
	cntA = collections.Counter(A)
	cntB = collections.Counter(B)
	return min(cntA[0], cntB[1]) + min(cntA[1], cntB[0])
print(solve())


(n, m) = list(map(int, input().strip().split()))
a = list(map(int, input().strip().split()))
b = list(map(int, input().strip().split()))
c = 0
d = 0
e = 0
f = 0
for i in range(n):
	if a[i] % 2 == 0:
		c = c + 1
	else:
		d = d + 1
for j in range(m):
	if b[j] % 2 == 0:
		e = e + 1
	else:
		f = f + 1
print(min(c, f) + min(d, e))


(n, m) = [int(s) for s in input().split()]
array_1 = [int(s) for s in input().split()]
array_2 = [int(s) for s in input().split()]
a_1 = 0
a_2 = 0
b_1 = 0
b_2 = 0
for elem in array_1:
	if elem % 2 == 0:
		a_1 += 1
	else:
		a_2 += 1
for elem in array_2:
	if elem % 2 == 0:
		b_1 += 1
	else:
		b_2 += 1
print(min(a_1, b_2) + min(a_2, b_1))


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')
	(n, m) = map(int, inp[0].split())
	a = sum((int(i) % 2 for i in inp[1].split()))
	b = sum((int(i) % 2 for i in inp[2].split()))
	return min(a, m - b) + min(b, n - a)
print(main())


import sys
from sys import setrecursionlimit
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 1000000007
mini = 1000000007
setrecursionlimit(10 ** 5)

def max_subarray(array):
	max_so_far = max_ending_here = array[0]
	start_index = 0
	end_index = 0
	for i in range(1, len(array) - 1):
		temp_start_index = temp_end_index = None
		if array[i] > max_ending_here + array[i]:
			temp_start_index = temp_end_index = i
			max_ending_here = array[i]
		else:
			temp_end_index = i
			max_ending_here = max_ending_here + array[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
			if temp_start_index != None:
				start_index = temp_start_index
			end_index = i
	print(max_so_far, start_index, end_index)

def ncr(n, r):
	d = 10 ** 9 + 7
	num = fact(n)
	den = fact(r) * fact(n - r) % d
	den = pow(den, d - 2, d)
	return num * den % d

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

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def calculate_factors(n):
	hh = [1] * (n + 1)
	p = 2
	while p * p < n:
		if hh[p] == 1:
			for i in range(p * 2, n, p):
				hh[i] = 0
		p += 1
	total = 1
	for p in range(2, n + 1):
		if hh[p] == 1:
			count = 0
			if n % p == 0:
				while n % p == 0:
					n = int(n / p)
					count += 1
				total *= count + 1
	return total

def prime_factors(n):
	i = 2
	factors = set()
	while i * i <= n:
		if n % i:
			i += 1
		else:
			factors.add(n // i)
			n = n // i
			factors.add(i)
	if n > 1:
		factors.add(n)
	return factors

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

def solve(n):
	if n == 1:
		return 1
	p = 2
	result = []
	while p * p <= n:
		if n % p == 0:
			result.append(p)
			result.append(n // p)
		p = p + 1
	return result

def atMostSum(arr, n, k):
	_sum = 0
	cnt = 0
	maxcnt = 0
	for i in range(n):
		if _sum + arr[i] <= k:
			_sum += arr[i]
			cnt += 1
		elif sum != 0:
			_sum = _sum - arr[i - cnt] + arr[i]
		maxcnt = max(cnt, maxcnt)
	return maxcnt

def solve(a, b):
	global nos
	if a == b:
		return nos
	nos += 1
	return solve(max(a - b, b), min(a - b, b))

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, m) = get_ints()
N = get_array()
M = get_array()
c_even_1 = 0
c_even_2 = 0
c_odd_1 = 0
c_odd_2 = 0
for i in N:
	if i & 1:
		c_odd_1 += 1
	else:
		c_even_1 += 1
for i in M:
	if i & 1:
		c_odd_2 += 1
	else:
		c_even_2 += 1
print(min(c_odd_1, c_even_2) + min(c_odd_2, c_even_1))


(n, m) = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
on = 0
en = 0
om = 0
em = 0
for i in range(n):
	if l1[i] % 2 == 0:
		en += 1
	else:
		on += 1
for i in range(m):
	if l2[i] % 2 == 0:
		em += 1
	else:
		om += 1
print(min(em, on) + min(en, om))


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


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a0 = a1 = b0 = b1 = 0
for x in a:
	a0 += x % 2 == 0
	a1 += x % 2
for x in b:
	b0 += x % 2 == 0
	b1 += x % 2
print(min(a0, b1) + min(a1, b0))


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inar():
	return [int(k) for k in input().split()]

def main():
	(n, m) = map(int, input().split())
	chest = inar()
	key = inar()
	ans = 0
	chest_odd = 0
	chest_even = 0
	key_odd = 0
	key_even = 0
	for i in range(n):
		if chest[i] % 2 == 0:
			chest_even += 1
		else:
			chest_odd += 1
	for i in range(m):
		if key[i] % 2 == 0:
			key_even += 1
		else:
			key_odd += 1
	print(min(chest_odd, key_even) + min(chest_even, key_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')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = input().split()
ch1 = 0
ch2 = 0
k1 = 0
k2 = 0
chests = input().split()
for i in chests:
	if int(i) % 2:
		ch2 += 1
	else:
		ch1 += 1
keys = input().split()
for i in keys:
	if int(i) % 2:
		k2 += 1
	else:
		k1 += 1
print(min(ch1, k2) + min(ch2, k1))


import os
import sys

def log(*args, **kwargs):
	if os.environ.get('CODEFR'):
		print(*args, **kwargs)
(n, m) = tuple(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = len([i for i in a if i % 2 == 1])
a2 = len([i for i in a if i % 2 == 0])
b1 = len([i for i in b if i % 2 == 1])
b2 = len([i for i in b if i % 2 == 0])
print(min(a1, b2) + min(a2, b1))


from collections import Counter
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
A = [a % 2 for a in A]
CA = Counter(A)
B = list(map(int, input().split()))
B = [b % 2 for b in B]
CB = Counter(B)
print(min(CA[1], CB[0]) + min(CA[0], CB[1]))


import math
mod = 1000000007

def power(a, b):
	res = 1
	b = b % (mod - 1)
	while b > 0:
		if b % 2 != 0:
			res = res % mod * (a % mod) % mod
		b = b // 2
		a = a % mod
		a = a * a % mod
	res = res % mod
	return res
(n, m) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
e1 = 0
e2 = 0
o1 = 0
o2 = 0
for i in range(n):
	if a[i] % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for i in range(m):
	if b[i] % 2 == 0:
		e2 += 1
	else:
		o2 += 1
s = min(e1, o2) + min(e2, o1)
print(s)


(n, m) = input().split(' ')
n = int(n)
m = int(m)
x_odd = 0
x_eve = 0
y_odd = 0
y_eve = 0
a = input().split(' ')
b = input().split(' ')
for i in range(n):
	x = int(a[i])
	if x % 2 == 1:
		x_odd = x_odd + 1
	else:
		x_eve = x_eve + 1
for j in range(m):
	x = int(b[j])
	if x % 2 == 1:
		y_odd = y_odd + 1
	else:
		y_eve = y_eve + 1
ans = min(x_odd, y_eve) + min(x_eve, y_odd)
print(ans)


import math

def game(chests, keys):
	even_count = len([c for c in chests if c % 2 == 0])
	odd_count = len([c for c in chests if c % 2 == 1])
	even_k_count = len([c for c in keys if c % 2 == 0])
	odd_k_count = len([c for c in keys if c % 2 == 1])
	return min(even_k_count, odd_count) + min(odd_k_count, even_count)
(n, m) = str(input()).split()
chests = [int(c) for c in input().split()]
keys = [int(c) for c in input().split()]
print(game(chests, keys))


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


import sys
cases = sys.stdin.readline().rstrip()
c = [int(i) % 2 for i in sys.stdin.readline().rstrip().split(' ')]
k = [int(i) % 2 for i in sys.stdin.readline().rstrip().split(' ')]
cn = [c.count(0)]
cn.append(len(c) - cn[0])
kn = [k.count(0)]
kn.append(len(k) - kn[0])
print(min(cn[0], kn[1]) + min(cn[1], kn[0]))


def main():
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(a0, b0) = (list(filter(lambda x: x % 2 == 1, a)), list(filter(lambda x: x % 2 == 1, b)))
	print(min(len(a0), m - len(b0)) + min(n - len(a0), len(b0)))
main()


(n, m) = map(int, input().split())
a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
ch_k = 0
nech_k = 0
ch_s = 0
nech_s = 0
s = 0
for i in range(n):
	if a[i] % 2 == 0:
		ch_s += 1
	else:
		nech_s += 1
for i in range(m):
	if b[i] % 2 == 0:
		ch_k += 1
	else:
		nech_k += 1
s = min(ch_k, nech_s) + min(ch_s, nech_k)
print(s)


(n, m) = list(map(int, input().split()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cae = sum([a % 2 == 0 for a in al])
cao = sum([a % 2 == 1 for a in al])
cbe = sum([b % 2 == 0 for b in bl])
cbo = sum([b % 2 == 1 for b in bl])
print(min(cae, cbo) + min(cao, cbe))


(n, m) = map(int, input().split())
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
odd_chests = [i for i in chests if i % 2 == 1]
even_chests = [i for i in chests if i % 2 == 0]
odd_keys = [i for i in keys if i % 2 == 1]
even_keys = [i for i in keys if i % 2 == 0]
total_even_odd = min(len(even_chests), len(odd_keys))
total_odd_even = min(len(odd_chests), len(even_keys))
print(total_even_odd + total_odd_even)


def main():
	(n, m) = input().split(' ')
	n = int(n)
	m = int(m)
	arr = input().split(' ')
	cta1 = 0
	cta0 = 0
	for i in range(n):
		arr[i] = int(arr[i])
		if arr[i] % 2 == 1:
			cta1 = cta1 + 1
		else:
			cta0 = cta0 + 1
	barr = input().split(' ')
	ctb1 = 0
	ctb0 = 0
	for i in range(m):
		barr[i] = int(barr[i])
		if barr[i] % 2 == 1:
			ctb1 = ctb1 + 1
		else:
			ctb0 = ctb0 + 1
	val = min(cta0, ctb1) + min(cta1, ctb0)
	print(val)
main()


(n, m) = map(int, input().split())
mat = list(map(int, input().split()))
sat = list(map(int, input().split()))
mat = sum((1 for i in mat if i % 2 == 1))
sat = sum((1 for i in sat if i % 2 == 1))
print(min(sat, n - mat) + min(mat, m - sat))


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def solve():
	(n, m) = f()
	a = f()
	b = f()
	aodd = 0
	aeven = 0
	bodd = 0
	beven = 0
	for i in a:
		if i & 1:
			aodd += 1
		else:
			aeven += 1
	for i in b:
		if i & 1:
			bodd += 1
		else:
			beven += 1
	print(min(aodd, beven) + min(aeven, bodd))
solve()


(n, m) = input().split()
n = int(n)
m = int(m)
a_inp = input()
a = [int(ele) for ele in a_inp.split()]
b_inp = input()
b = [int(ele) for ele in b_inp.split()]
even_a = 0
odd_a = 0
even_b = 0
odd_b = 0
for ele in a:
	if ele % 2 == 0:
		even_a += 1
	else:
		odd_a += 1
for ele in b:
	if ele % 2 == 0:
		even_b += 1
	else:
		odd_b += 1
count = 0
if even_a < odd_b:
	count += even_a
else:
	count += odd_b
if even_b < odd_a:
	count += even_b
else:
	count += odd_a
print(count)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
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 main():
	(n, m) = LI()
	a = LI()
	b = LI()
	c = collections.defaultdict(int)
	d = collections.defaultdict(int)
	for e in a:
		c[e % 2] += 1
	for e in b:
		d[e % 2] += 1
	return min(c[0], d[1]) + min(c[1], d[0])
print(main())


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
k = list(map(int, input().split()))
filtered1 = len(list(filter(lambda x: x % 2 == 0, l)))
filtered2 = len(list(filter(lambda x: x % 2 == 0, k)))
print(min(filtered1, len(k) - filtered2) + min(filtered2, len(l) - filtered1))


(a, b) = map(int, input().split())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
odds = sum((1 for i in arr2 + arr1 if i % 2 == 1))
even = a + b - odds
ans = min(a, b, odds, even)
print(ans)


(n, m) = map(int, input().strip().split())
chest = [int(x) for x in input().split()]
keys = [int(y) for y in input().split()]
odd1 = even1 = odd2 = even2 = 0
for i in chest:
	if i % 2 == 0:
		odd1 += 1
	else:
		even1 += 1
for j in keys:
	if j % 2 == 0:
		odd2 += 1
	else:
		even2 += 1
ans = min(odd1, even2) + min(even1, odd2)
print(ans)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(p1, p2) = (0, 0)
for i in range(n):
	if a[i] % 2 == 0:
		p1 += 1
	else:
		p2 += 1
(q1, q2) = (0, 0)
for i in range(m):
	if b[i] % 2 == 0:
		q1 += 1
	else:
		q2 += 1
print(min(p1, q2) + min(p2, q1))


(n, m) = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]
b = [int(item) for item in input().split()]
(even_a, even_b, odd_a, odd_b) = (0, 0, 0, 0)
for i in range(n):
	if a[i] % 2:
		odd_a += 1
	else:
		even_a += 1
for i in range(m):
	if b[i] % 2:
		odd_b += 1
	else:
		even_b += 1
print(min(even_a, odd_b) + min(odd_a, even_b))


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


(a, b) = input().split()
(a, b) = (int(a), int(b))
c = input().split()
d = input().split()
c1 = []
c2 = []
k = 0
for i in range(a):
	if int(c[i]) % 2 == 0:
		c1.append(int(c[i]))
	else:
		c2.append(int(c[i]))
for i in range(b):
	if len(c1) == 0 and len(c2) == 0:
		break
	elif int(d[i]) % 2 == 0 and len(c2) > 0:
		k += 1
		c2.pop(0)
	elif int(d[i]) % 2 == 1 and len(c1) > 0:
		k += 1
		c1.pop(0)
print(k)


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
(az, af, bz, bf) = (0, 0, 0, 0)
for i in a:
	if i % 2:
		af += 1
	else:
		az += 1
for i in b:
	if i % 2:
		bf += 1
	else:
		bz += 1
print(min(af, bz) + min(az, bf))


(n, m) = map(int, input().split())
quests = list(map(int, input().split()))
keys = list(map(int, input().split()))
q_odd = len(list(filter(lambda x: x & 1 == 1, quests)))
q_even = n - q_odd
k_odd = len(list(filter(lambda x: x & 1 == 1, keys)))
k_even = m - k_odd
print(min(q_even, k_odd) + min(q_odd, k_even))


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


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


(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
(c1, c2, c3, c4) = (0, 0, 0, 0)
for val in A:
	if val % 2 == 0:
		c1 += 1
	else:
		c2 += 1
for val in B:
	if val % 2 == 0:
		c3 += 1
	else:
		c4 += 1
total = 0
total += min(c1, c4)
total += min(c2, c3)
print(total)


(N, M) = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
(o1, o2) = (0, 0)
(e1, e2) = (0, 0)
for i in A:
	if i % 2 == 0:
		e1 += 1
	else:
		o1 += 1
for i in B:
	if i % 2 == 0:
		e2 += 1
	else:
		o2 += 1
print(min(o1, e2) + min(o2, e1))


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	b = map(int, input().split())
	ec = 0
	oc = 0
	ek = 0
	ok = 0
	for i in a:
		if i & 1:
			oc += 1
		else:
			ec += 1
	for i in b:
		if i & 1:
			ok += 1
		else:
			ek += 1
	print(min(ec, ok) + min(oc, ek))
main()


def a_func(keys, chests):
	n = len(keys)
	m = len(chests)
	keysodd = 0
	keyseven = 0
	chestsodd = 0
	chestseven = 0
	for i in range(n):
		if keys[i] % 2 == 0:
			keyseven += 1
		else:
			keysodd += 1
	for i in range(m):
		if chests[i] % 2 == 0:
			chestseven += 1
		else:
			chestsodd += 1
	return min(keysodd, chestseven) + min(keyseven, chestsodd)
(n, m) = list(map(int, input().strip().split()))
keys = list(map(int, input().strip().split()))
chests = list(map(int, input().strip().split()))
print(a_func(keys, chests))


(chests, keys) = list(map(int, input().split()))
arr_chests = list(map(int, input().split()))
arr_keys = list(map(int, input().split()))
ch_eve = 0
ch_odd = 0
ke_eve = 0
ke_odd = 0
for each_ele in arr_chests:
	if each_ele % 2 == 0:
		ch_eve += 1
ch_odd = chests - ch_eve
for each_ele in arr_keys:
	if each_ele % 2 == 0:
		ke_eve += 1
ke_odd = keys - ke_eve
print(min(ch_odd, ke_eve) + min(ch_eve, ke_odd))


def main(chest_n, key_n):
	chests = list(map(lambda x: int(x) % 2, input().split()))
	keys = list(map(lambda x: int(x) % 2, input().split()))
	return min(chests.count(1), keys.count(0)) + min(chests.count(0), keys.count(1))
(a, b) = map(int, input().split())
print(main(a, b))


(n, m) = list(map(int, input().split()))
chests = list(map(int, input().split()))
keys = list(map(int, input().split()))
oddchest = 0
evenchest = 0
oddkey = 0
evenkey = 0
for i in chests:
	if i % 2 == 0:
		evenchest += 1
	else:
		oddchest += 1
for i in keys:
	if i % 2 == 0:
		evenkey += 1
	else:
		oddkey += 1
print(min(oddkey, evenchest) + min(evenkey, oddchest))


a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
k = 0
if len(b) == a[0] and len(c) == a[1]:
	(be, bo, ce, co) = (0, 0, 0, 0)
	for i in range(a[0]):
		if b[i] % 2 == 0:
			be = be + 1
		else:
			bo = bo + 1
	for j in range(a[1]):
		if c[j] % 2 == 0:
			ce = ce + 1
		else:
			co = co + 1
if bo > ce:
	k = k + ce
else:
	k = k + bo
if co > be:
	k = k + be
else:
	k = k + co
print(k)


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


(n, m) = map(int, input().split())
odd1 = 0
odd2 = 0
even1 = 0
even2 = 0
ar1 = list(map(int, input().split()))
ar2 = list(map(int, input().split()))
for i in ar1:
	if i % 2 == 1:
		odd1 += 1
	else:
		even1 += 1
for i in ar2:
	if i % 2 == 1:
		odd2 += 1
	else:
		even2 += 1
print(min(even2, odd1) + min(even1, odd2))


(n, m) = map(int, input().split())
a = [int(num) for num in input().split()]
b = [int(num) for num in input().split()]
ea = list(filter(lambda n: n % 2 == 0, a))
eb = list(filter(lambda n: n % 2 == 0, b))
print(min(len(ea), m - len(eb)) + min(len(eb), n - len(ea)))


(c, k) = input().split()
clist = list(map(int, input().split()))
klist = list(map(int, input().split()))
mini = min(int(c), int(k))
ceven = 0
codd = 0
keven = 0
kodd = 0
for i in range(int(c)):
	if clist[i] % 2 == 0:
		ceven += 1
	else:
		codd += 1
for i in range(int(k)):
	if klist[i] % 2 == 0:
		keven += 1
	else:
		kodd += 1
count = min(ceven, kodd) + min(codd, keven)
print(count)


(n, m) = map(int, input().split())
chest = list(map(int, input().split()))
keys = list(map(int, input().split()))
pChest = [0] * 2
for k in chest:
	pChest[k % 2] += 1
pKey = [0] * 2
for k in keys:
	pKey[k % 2] += 1
r = min(pKey[1], pChest[0]) + min(pKey[0], pChest[1])
print(r)


import sys
inf = float('inf')
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 int1():
	return int(input())
import string
import math
from itertools import combinations

def main():
	(n, m) = get_array()
	a = get_array()
	b = get_array()
	l1 = []
	l2 = []
	l3 = []
	l4 = []
	for i in a:
		if i % 2 == 0:
			l1.append(i)
		else:
			l2.append(i)
	for i in b:
		if i % 2 == 0:
			l3.append(i)
		else:
			l4.append(i)
	r = min(len(l1), len(l4)) + min(len(l2), len(l3))
	print(r)
main()


input()
box = map(int, input().split())
key = map(int, input().split())
(cb, nb, ck, nk) = (0, 0, 0, 0)
for i in box:
	if i % 2 == 0:
		cb += 1
	else:
		nb += 1
for i in key:
	if i % 2 == 0:
		ck += 1
	else:
		nk += 1
print(min(cb, nk) + min(nb, ck))


def read_int():
	return int(input())

def read_ints(n, sep=' '):
	assert n >= 1
	raw = input().split(sep)
	assert len(raw) == n, 'Invalid number of tokens read.'
	return [int(r) for r in raw]

def solve(chests, keys):
	(ce, co) = (0, 0)
	for c in chests:
		if c % 2 == 0:
			ce += 1
		else:
			co += 1
	(ke, ko) = (0, 0)
	for k in keys:
		if k % 2 == 0:
			ke += 1
		else:
			ko += 1
	return min(ce, ko) + min(co, ke)
(n_chests, n_keys) = read_ints(2)
chests = read_ints(n_chests)
keys = read_ints(n_keys)
print(solve(chests, keys))


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
(c1, c2, c3, c4) = (0, 0, 0, 0)
for i in range(n):
	if l[i] % 2 == 0:
		c2 += 1
	else:
		c1 += 1
for j in range(m):
	if l1[j] % 2 == 0:
		c4 += 1
	else:
		c3 += 1
print(min(c1, c4) + min(c3, c2))


from sys import stdin
(x, y) = [int(x) for x in stdin.readline().split()]
chests = [int(x) for x in stdin.readline().split()]
keys = [int(x) for x in stdin.readline().split()]
imp1 = 0
par1 = 0
for i in chests:
	if i % 2 == 0:
		par1 += 1
	else:
		imp1 += 1
imp2 = 0
par2 = 0
for i in keys:
	if i % 2 == 0:
		par2 += 1
	else:
		imp2 += 1
print(min(imp1, par2) + min(imp2, par1))


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

def si():
	return input()

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

def li():
	return list(mi())
mod = 1000000000.0
(n, m) = mi()
a = li()
b = li()
n1 = 0
n2 = 0
e1 = 0
e2 = 0
for i in range(n):
	if a[i] % 2:
		n1 += 1
	else:
		e1 += 1
for i in range(m):
	if b[i] % 2:
		n2 += 1
	else:
		e2 += 1
s = min(n1, e2)
s += min(n2, e1)
print(s)


(n, m) = map(int, input().split())
n1 = list(map(int, input().split()))
m1 = list(map(int, input().split()))
ne = len(list(filter(lambda x: x % 2, n1)))
me = len(list(filter(lambda x: x % 2, m1)))
(c1, c2) = (min(ne, m - me), min(n - ne, me))
print(c1 + c2)