Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?

There are $n$ students living in a building, and for each of them the favorite drink $a_i$ is known. So you know $n$ integers $a_1, a_2, \dots, a_n$, where $a_i$ ($1 \le a_i \le k$) is the type of the favorite drink of the $i$-th student. The drink types are numbered from $1$ to $k$.

There are infinite number of drink sets. Each set consists of exactly two portions of the same drink. In other words, there are $k$ types of drink sets, the $j$-th type contains two portions of the drink $j$. The available number of sets of each of the $k$ types is infinite.

You know that students will receive the minimum possible number of sets to give all students exactly one drink. Obviously, the number of sets will be exactly $\lceil \frac{n}{2} \rceil$, where $\lceil x \rceil$ is $x$ rounded up.

After students receive the sets, they will distribute their portions by their choice: each student will get exactly one portion. Note, that if $n$ is odd then one portion will remain unused and the students' teacher will drink it.

What is the maximum number of students that can get their favorite drink if $\lceil \frac{n}{2} \rceil$ sets will be chosen optimally and students will distribute portions between themselves optimally?


-----Input-----

The first line of the input contains two integers $n$ and $k$ ($1 \le n, k \le 1\,000$) — the number of students in the building and the number of different drinks.

The next $n$ lines contain student's favorite drinks. The $i$-th line contains a single integer from $1$ to $k$ — the type of the favorite drink of the $i$-th student.


-----Output-----

Print exactly one integer — the maximum number of students that can get a favorite drink.


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

Output
4

Input
10 3
2
1
3
2
3
3
1
3
1
2

Output
9



-----Note-----

In the first example, students could choose three sets with drinks $1$, $1$ and $2$ (so they will have two sets with two drinks of the type $1$ each and one set with two drinks of the type $2$, so portions will be $1, 1, 1, 1, 2, 2$). This way all students except the second one will get their favorite drinks.

Another possible answer is sets with drinks $1$, $2$ and $3$. In this case the portions will be $1, 1, 2, 2, 3, 3$. Then all the students except one will gain their favorite drinks. The only student that will not gain the favorite drink will be a student with $a_i = 1$ (i.e. the first, the third or the fourth).

Difficulty: EASY

Solutions:
from sys import *
from math import *
(n, k) = map(int, stdin.readline().split())
a = []
for i in range(n):
	x = int(input())
	a.append(x)
a.sort()
b = [a[0]]
for i in range(1, n):
	if a[i] != a[i - 1]:
		b.append(a[i])
cnt = [0] * len(b)
j = 0
for i in range(n):
	if a[i] == b[j]:
		cnt[j] += 1
	else:
		j += 1
		cnt[j] += 1
cnt.sort()
cnt = cnt[::-1]
x = n // 2
ans = 0
if n % 2 != 0:
	x += 1
ans = 0
for i in range(len(cnt)):
	x -= cnt[i] // 2
	x -= cnt[i] % 2
	ans += cnt[i]
print(ans + x)


from sys import stdin
from collections import Counter

def main():
	(n, k) = map(int, input().split())
	ss = [int(input()) for _ in range(n)]
	sc = [x % 2 for x in Counter(ss).values()]
	result = n - sum(sc) // 2
	print(result)
main()


import sys
inf = float('inf')
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

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()
(q, k) = get_ints()
drinks = ceil(q / 2)
mydict = dict()
for i in range(q):
	z = int(input())
	mydict[z] = mydict.get(z, 0) + 1
count = 0
for i in range(drinks):
	c = -1
	maxi = -1
	for i in mydict:
		if mydict[i] > maxi:
			c = i
			maxi = mydict[i]
	if mydict[c] > 2:
		mydict[c] -= 2
		count += 2
	else:
		count += mydict[c]
		del mydict[c]
print(count)


Input = lambda : map(int, input().split())
(n, k) = Input()
arr = [0] * k
for i in range(n):
	a = int(input()) - 1
	arr[a] += 1
odd = 0
for i in range(k):
	odd += arr[i] % 2
print(n - odd // 2)


(n, k) = map(int, input().split())
fav = [0 for i in range(k + 1)]
for i in range(n):
	a = int(input())
	fav[a] += 1
ans = 0
K = (n + 1) // 2
for i in range(1, k + 1):
	if fav[i] % 2 == 0:
		ans += fav[i]
		K -= fav[i] // 2
		fav[i] = 0
	else:
		ans += fav[i] - 1
		K -= fav[i] // 2
		fav[i] = 1
ans += K
print(ans)


(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	a[int(input()) - 1] += 1
e = 0
for i in range(len(a)):
	e += a[i] % 2
print(n - e // 2)


temp = input().split()
n = int(temp[0])
k = int(temp[1])
entr = []
for i in range(n):
	entr.append(int(input()))
unp = 0
for j in range(1, k + 1):
	if entr.count(j) % 2:
		unp += 1
unpp = unp
if unp % 2:
	unpp += 1
out = n - unp + unpp / 2
print(int(out))


import sys
(n, k) = [int(i) for i in sys.stdin.readline().split()]
a = dict()
for i in range(n):
	x = int(sys.stdin.readline()) - 1
	if x in a:
		a[x] += 1
	else:
		a[x] = 1
s = 0
for i in a.items():
	s += i[1] % 2
s //= 2
print(n - s)


import math
(n, k) = map(int, input().split())
arr = [0 for i in range(2000)]
for i in range(n):
	m = int(input())
	arr[m] += 1
count = 0
for i in range(1, k + 1):
	if arr[i] % 2 != 0:
		count += 1
print(n - math.ceil(count // 2))


import math
(n, k) = list(map(int, input().split()))
A = []
K = [0] * (k + 7)
for t in range(n):
	cin = int(input())
	A.append(cin)
	K[cin] += 1
K.sort(reverse=True)
ans = 0
drink = math.ceil(n / 2)
i = 0
while i < k and drink > 0:
	if K[i] >= 2:
		K[i] -= 2
		ans += 2
		drink -= 1
	else:
		i += 1
i = 0
while i < k and drink > 0:
	if K[i] > 0:
		ans += 1
		drink -= 1
	i += 1
print(ans)


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

class Solution2:

	def solve(self, s):
		pass

class Solution:

	def solve(self, favorites):
		drink_count = collections.Counter(favorites)
		sets = (len(favorites) + 1) // 2
		out = 0
		for count in drink_count.values():
			out += count - count % 2
		rem = len(favorites) - out
		return out + (rem + 1) // 2
sol = Solution()
sol2 = Solution2()
for test_case in range(1):
	(N, K) = input().split()
	s = []
	for _ in range(int(N)):
		s.append(int(input()))
	out = sol.solve(s)
	print(str(out))


(n, k) = [int(i) for i in input().split()]
drinks = {}
for _ in range(n):
	drink = int(input())
	if drink not in drinks:
		drinks[drink] = 0
	drinks[drink] += 1
answer = 0
use_extra_portion = True
for drink in drinks:
	drinks_count = drinks[drink]
	if drinks_count % 2 == 0:
		answer += drinks_count
	elif use_extra_portion:
		answer += drinks_count
		use_extra_portion = False
	else:
		answer += drinks_count - 1
		use_extra_portion = True
print(answer)


(n, k) = map(int, input().split())
c = [0] * k
for _ in [0] * n:
	c[int(input()) - 1] += 1
print(n - sum((x % 2 for x in c)) // 2)


import math
(n, k) = list(map(int, input().split(' ')))
dc = {}
for _ in range(n):
	num = int(input())
	if num not in dc:
		dc[num] = 1
	else:
		dc[num] += 1
count = math.ceil(n / 2)
arr = sorted(dc.values())
ans = 0
ones = 0
for (idx, num) in enumerate(reversed(arr)):
	if count > num // 2:
		ans += 2 * (num // 2)
		count -= num // 2
		if num & 1:
			ones += 1
	else:
		ans += count * 2
		count = 0
		print(ans)
		exit(0)
ans += min(ones, count)
print(ans)


(n, k) = map(int, input().split(' '))
a = [0] * (k + 1)
for i in range(n):
	a[int(input())] += 1
a = sorted(a)[::-1]
from math import *
s = int(ceil(n / 2))
ans = 0
for _ in range(s):
	if a[0] == 1:
		ans += 1
	else:
		ans += 2
	a[0] -= 2
	a[0] = max(0, a[0])
	a = sorted(a)[::-1]
print(ans)


uniqelist = []
uniqecount = []

def getUnique(item):
	if item not in uniqelist:
		uniqelist.append(item)
		uniqecount.append(1)
	else:
		x = uniqelist.index(item)
		uniqecount[x] += 1
(m, n) = map(int, input().split())
t = m
for i in range(m):
	getUnique(int(input()))
for i in range(len(uniqecount)):
	while uniqecount[i] >= 2 and m >= 2:
		uniqecount[i] -= 2
		m -= 2
for i in range(len(uniqecount)):
	while uniqecount[i] >= 1 and m > 0:
		m -= 2
		uniqecount[i] -= 2
for i in uniqecount:
	if i > 0:
		t -= i
print(t)


answer = 0
d = {}
(a, b) = list(map(int, input().split()))
for i in range(a):
	n = int(input())
	if n in d:
		d[n] = d[n] + 1
	else:
		d[n] = 1
an = sorted([y for (i, y) in d.items()], key=lambda x: x % 2)
print(a - sum((x % 2 for x in an)) // 2)


def f(l):
	mx = max(l)
	n = len(l)
	cl = [0] * mx
	for i in l:
		cl[i - 1] += 1
	np = sum([c // 2 for c in cl])
	return (np << 1) + (n - (np << 1) + 1) // 2
(n, k) = list(map(int, input().split()))
l = [int(input()) for _ in range(n)]
print(f(l))


(n, k) = list(map(int, input().split()))
a = {}
for _ in range(n):
	t = int(input())
	if t in a:
		a[t] += 1
	else:
		a[t] = 1
a = sorted(zip(a.values(), a.keys()))
a = list(zip(*a))
a = a[0]
b = [i for i in a if i % 2 == 0]
c = [i for i in a if i % 2 == 1]
print(sum(b) + sum(c) - len(c) // 2)


(n, k) = map(int, input().split())
a = [0] * (k + 1)
ans = 0
for i in range(n):
	x = int(input())
	if a[x] == 1:
		ans += 2
		a[x] = 0
	else:
		a[x] += 1
bad = n - ans
print(ans + (bad - 1) // 2 + 1)


import math
(n, k) = map(int, input().split())
l = []
for i in range(n):
	l.append(int(input()))
p = math.ceil(n / 2)
q = p
m = set(l)
t = 0
for i in m:
	c = l.count(i)
	if p > 0:
		p = p - c // 2
if p == 0:
	print(n)
else:
	t = 2 * (q - p) + p
	print(t)


(n, k) = map(int, input().split())
d = [0] * (k + 1)
for i in range(n):
	a = int(input())
	d[a] += 1
d.sort(reverse=True)
count = 0
for i in range(k):
	count += d[i] - d[i] % 2
	d[i] = d[i] % 2
d.append(1)
count += d.count(1) // 2
print(count)


from collections import Counter
(n, k) = map(int, input().split())
x = Counter((int(input()) for _ in range(n)))
z = sum((v & 1 for v in x.values()))
print(n - z // 2)


(n, k) = map(int, input().split(' '))
d = [0] * (k + 1)
for i in range(n):
	x = int(input())
	d[x] += 1
if n % 2 == 0:
	s = n // 2
else:
	s = n // 2 + 1
c = 0
d = sorted(d)
j = 1
while s != 0 and j <= k:
	if d[j] % 2 == 0:
		count = d[j] // 2
		if s <= count:
			c += s * 2
			s = 0
		else:
			c += count * 2
			s = s - count
	else:
		count = d[j] // 2
		if s <= count:
			c += s * 2
			s = 0
		else:
			c += count * 2
			s = s - count
	d[j] -= count * 2
	j += 1
c = c + s
if c > n:
	print(n)
else:
	print(c)


(n, k) = list((int(a) for a in input().split()))
p = list((0 for _ in range(k)))
c = 0
b = True
for _ in range(n):
	p[int(input()) - 1] += 1
for pi in p:
	if pi & 1:
		if b:
			c += pi
			b = False
		else:
			c += pi - 1
			b = True
	else:
		c += pi
print(c)


(n, k) = map(int, input().split())
arr = [0] * k
for i in range(n):
	arr[int(input()) - 1] += 1
shaman = 1
ans = 0
for i in range(k):
	ans += arr[i] // 2 * 2
	shaman += arr[i] % 2
print(ans + shaman // 2)


import math
(n, k) = map(int, input().split())
a = [0] * k
for _ in range(n):
	g = int(input())
	a[g - 1] += 1
s = math.ceil(n / 2)
temp = s
ans = 0
for i in range(0, k):
	m = a[i] // 2
	a[i] = a[i] - m * 2
	if s > 0:
		s = s - m
		ans = ans + m
if s <= 0:
	print(ans * 2)
else:
	temp = temp - ans
	print(ans * 2 + temp)


from math import ceil
(n, k) = map(int, input().split())
a = []
good = 0
for i in range(n):
	b = int(input())
	if b in a:
		a.remove(b)
		good += 2
	else:
		a.append(b)
print(good + ceil(len(a) / 2))


from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

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

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n').split(' ')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
(n, k) = li()
tot = 0
l = Counter()
for i in range(n):
	l[val()] += 1
for i in l:
	tot += l[i] >> 1 << 1
	l[i] = l[i] & 1
n = math.ceil(n / 2)
n -= tot // 2
i = 0
for i in l:
	if not n:
		break
	if l[i]:
		n -= 1
		tot += 1
print(tot)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right, bisect_left
import math
from operator import itemgetter
from heapq import heapify, heappop, heappush
(n, k) = map(int, input().split())
x = dc(int)
for _ in range(n):
	x[int(input())] += 1
c = 0
for i in x:
	if x[i] % 2:
		c += x[i] - 1
	else:
		c += x[i]
c += math.ceil((n - c) / 2)
print(c)


(n, k) = map(int, input().split())
a = []
dic = {}
ans = []
for i in range(n):
	a.append(int(input()))
for i in a:
	if i in dic:
		dic[i] += 1
	else:
		dic[i] = 1
for (key, value) in dic.items():
	ans.append(value)
val = 0
for i in range(len(ans)):
	val += 2 * (ans[i] // 2)
	ans[i] = ans[i] % 2
cnt = ans.count(1)
val += (cnt - 1) // 2 + 1
print(val)


import math
(n, k) = map(int, input().split())
l = [0] * k
for i in range(n):
	n1 = int(input())
	l[n1 - 1] += 1
s = 0
lt = 0
for i in l:
	s = s + i // 2
	lt = lt + i % 2
print(2 * s + (lt + 1) // 2)


(n, k, d) = list(map(int, input().split())) + [[0] * 1001]
for i in range(n):
	d[int(input())] += 1
print(n - sum([i % 2 for i in d]) + (n // 2 + (n % 2 != 0)) - (n - sum([i % 2 for i in d])) // 2)


from math import ceil
(n, k) = [int(p) for p in input().split()]
freq = {}
for i in range(1, k + 1):
	freq[i] = 0
for i in range(n):
	freq[int(input())] += 1
total = 0
remain = 0
for i in freq:
	total += freq[i] // 2
	remain += freq[i] % 2
a = ceil(n / 2)
ans = 0
if total >= a:
	print(2 * a)
else:
	ans += 2 * total
	a -= total
	if a > 0:
		if remain >= a:
			ans += a
		else:
			ans += remain
	print(ans)


(a, b) = map(int, input().split())
l = []
c = 0
for i in range(a):
	l.append(int(input()))
s = set(l)
for i in s:
	if l.count(i) % 2 != 0:
		c += 1
print(a - c // 2)


from math import ceil
(n, k) = [int(x) for x in input().split()]
a = [0] * k
for i in range(n):
	a[int(input()) - 1] += 1
j = 0
ans = 0
for i in a:
	j += i // 2
	ans += i % 2
print(n - (ans - (ceil(n / 2) - j)))


import math
(n, k) = map(int, input().split())
A = []
for i in range(n):
	q = int(input())
	A.append(q)
x = math.ceil(n / 2)
m = x
Acount = []
for i in range(1, k + 1):
	Acount.append(A.count(i))
for i in range(m):
	for j in range(k):
		if Acount[j] >= 2:
			Acount[j] -= 2
			x -= 1
			break
m = x
if x > 0:
	for i in range(m):
		for j in range(k):
			if Acount[j] > 0:
				Acount[j] -= 1
				x -= 1
				break
ans = 0
for i in Acount:
	ans += i
print(n - ans)


import math
(n, k) = map(int, input().split())
d = {}
for i in range(n):
	f = int(input())
	if f in d:
		d[f] += 1
	else:
		d[f] = 1
ans = 0
cnt = 0
for i in d:
	ans += d[i] // 2 * 2
	cnt += d[i] % 2
print(ans + math.ceil(cnt / 2))


(n, k) = map(int, input().split())
li = []
for _ in range(n):
	li.append(int(input()))
s = set(li)
cnt = 0
for i in s:
	if li.count(i) % 2 != 0:
		cnt += 1
print(n - cnt // 2)


(n, k) = list(map(int, input().split()))
a = []
for i in range(n):
	a.append(int(input()))
drinkCount = {i: a.count(i) for i in a}
for i in range(1, k + 1):
	if i in drinkCount:
		if drinkCount[i] % 2 == 0:
			del drinkCount[i]
		else:
			drinkCount[i] = 1
	else:
		pass
print(n - len(drinkCount) // 2)


(pupils, types) = map(int, input().split())
dct = {i + 1: 0 for i in range(types)}
for i in range(pupils):
	dct[int(input())] += 1
res = 0
for v in dct.values():
	if v % 2:
		res += 1
print(pupils - res // 2)


from collections import defaultdict
d = defaultdict(int)
(n, k) = map(int, input().split())
for _ in range(n):
	a = int(input())
	d[a] += 1
count = 0
odd = 0
for i in d.keys():
	if d[i] % 2 == 0:
		count += d[i]
	else:
		count += d[i] - 1
		odd += 1
count += odd // 2
if odd % 2 == 1:
	count += 1
print(count)


(n, k) = map(int, input().split())
arr = [0 for i in range(k)]
for i in range(n):
	a = int(input()) - 1
	arr[a] = (arr[a] + 1) % 2
print(n - sum(arr) // 2)


from collections import Counter
(n, k) = list(map(int, input().split()))
x = Counter()
z = 0
for i in range(n):
	x[int(input())] += 1
for i in x:
	z += x[i] // 2
	x[i] = x[i] % 2
print(z + (n + 1) // 2)


import math
from collections import defaultdict
(n, k) = [int(i) for i in input().split()]
person_to_drink_type = defaultdict(int)
for _ in range(n):
	person_to_drink_type[input()] += 1
double_drink = sum((x // 2 for x in person_to_drink_type.values())) * 2
print(double_drink + math.ceil((n - double_drink) / 2))


import math
l = list(map(int, input().split()))
l1 = []
l2 = []
k = l[1]
n = l[0]
n = math.ceil(n / 2)
for i in range(l[0]):
	l1.append(int(input()))
for i in range(1, l[1] + 1):
	l2.append(int(l1.count(i)))
count = 0
l2.sort(reverse=True)
count1 = 0
for i in l2:
	if i % 2 == 0 and n != 0:
		if n >= i / 2:
			n = n - i / 2
			count += i
		else:
			count += n * 2
			n = 0
	elif n != 0:
		i = i - 1
		if n >= i / 2 and i != 0:
			n = n - i / 2
			count += i
			count1 = count1 + 1
		elif i != 0:
			count += n * 2
			n = 0
			count1 = count1 + 1
		elif i == 0:
			count1 = count1 + 1
count += n
print(int(count))


import math
(n, k) = list(map(int, input().split()))
a = []
o = [0] * k
for i in range(n):
	x = int(input())
	a.append(x)
	o[x - 1] += 1
nb_pairs = 0
for z in o:
	nb_pairs += z // 2
r = n - nb_pairs * 2
t = int(math.ceil(n / 2))
t -= nb_pairs
print(n - (r - t))


(n, k) = map(int, input().split())
odd_cnt = 0
a = [int(input()) for _ in range(n)]
aa = [0] * (k + 1)
for _a in a:
	aa[_a] += 1
for _aa in aa:
	if _aa & 1 == 1:
		odd_cnt += 1
print(n - odd_cnt // 2)


(n, k) = map(int, input().split())
numberOfStudents = {}
for _ in range(n):
	x = int(input())
	if x in numberOfStudents:
		numberOfStudents[x] += 1
	else:
		numberOfStudents[x] = 1
numberOfSets = (n + 1) // 2
count = 0
for (key, value) in numberOfStudents.items():
	numberOfSets -= value // 2
	if value % 2 == 0:
		count += value
	else:
		count = count + value - 1
print(numberOfSets + count)


import collections as cl
(n, k) = map(int, input().split())
a = list(sorted(cl.Counter([int(input()) for _ in range(n)]).values(), reverse=True))
v = sum([a[i] - a[i] % 2 for i in range(len(a))])
print(v + ((n + 1) // 2 - v // 2))


import sys
import math
import bisect

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


from collections import Counter
(n, _) = map(int, input().split())
print(n - sum((v % 2 for v in Counter((input() for _ in range(n))).values())) // 2)


from math import ceil
(n, k) = map(int, input().split())
a = [0] * (k + 1)
for _ in range(n):
	num = int(input())
	a[num] += 1
s = sum((x % 2 for x in a))
print(n - ceil(s / 2) + n % 2)


(n, k) = [int(x) for x in input().split(' ')]
from collections import defaultdict
d = defaultdict(int)
for i in range(n):
	soda = int(input())
	d[soda] += 1
sorted_d = sorted(d.values())
total = 0
from math import ceil
sets = ceil(n / 2)
while True:
	if sets <= 0 or not sorted_d:
		break
	tmp = sorted_d.pop()
	if tmp % 2 == 0:
		total += tmp
		sets -= tmp // 2
	elif tmp == 1:
		sets -= 1
		total += 1
	else:
		sets -= tmp // 2
		total += tmp - 1
		sorted_d = [1] + sorted_d
print(total)


from math import ceil
(n, k) = [int(x) for x in input().split()]
fav_drinks = set()
sets = 0
for _ in range(n):
	ip = int(input())
	if ip in fav_drinks:
		fav_drinks.remove(ip)
		sets = sets + 1
	else:
		fav_drinks.add(ip)
extra_satisfiable = ceil(n / 2) - sets
print(sets * 2 + extra_satisfiable)


from collections import Counter
(n, k) = map(int, input().split())
fav = Counter()
for _ in range(n):
	fav[int(input())] += 1
leftovers = 0
gets_fav = 0
for i in fav.values():
	gets_fav += i // 2 * 2
	leftovers += i % 2
gets_fav += -(-leftovers // 2)
print(gets_fav)


(n, k) = map(int, input().split())
odd_drinks = set()
for _ in range(n):
	d = int(input())
	if d in odd_drinks:
		odd_drinks.remove(d)
	else:
		odd_drinks.add(d)
res = n - len(odd_drinks) // 2
print(res)


def fact(n):
	if n <= 0:
		return 1
	if n <= 2:
		return n
	return n * fact(n - 1)

def comb(k, n):
	return fact(n) // (fact(k) * fact(n - k))

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

def main():
	(n, k) = map(int, input().split())
	m = n // 2
	if n % 2 == 1:
		m += 1
	cnt = {}
	for i in range(1, k + 1):
		cnt[i] = 0
	for i in range(n):
		x = int(input())
		cnt[x] = cnt[x] + 1
	ans = 0
	for i in range(1, k + 1):
		p = min(cnt[i] // 2, m)
		ans += 2 * p
		cnt[i] = cnt[i] - p * 2
		m -= p
		if m == 0:
			break
	if m > 0:
		for i in range(1, k + 1):
			if cnt[i] > 0:
				ans += 1
				m -= 1
				cnt[i] = 0
				if m == 0:
					break
	print(ans)
main()


from collections import Counter
(n, k) = [int(item) for item in input().split()]
drinks = (n + 1) // 2
fav = []
for i in range(n):
	fav.append(int(input()))
cnt = Counter(fav)
sets = 0
alones = 0
for key in cnt.keys():
	sets += cnt[key] // 2
	alones += cnt[key] % 2
if sets >= drinks:
	print(sets * 2)
else:
	print(min(sets * 2 + (drinks - sets), n))


import math
(n, k) = map(int, input().split())
l = []
s = []
c = 0
h = 0
r = math.ceil(n / 2)
for i in range(n):
	x = int(input())
	l.append(x)
for i in range(1, k + 1):
	s.append(l.count(i))
for j in range(len(s)):
	h += s[j] // 2
	if s[j] % 2 != 0:
		c += 1
f = abs(h + c - r)
print(n - f)


(n, k) = [int(x) for x in input().split()]
data = {}
for i in range(1, k + 1):
	data[i] = 0
for i in range(n):
	a = int(input())
	data[a] += 1
count = 0
drinks = 0
for k in data.keys():
	if data[k] % 2 == 0:
		count += data[k]
		drinks += data[k] / 2
		data[k] = 0
	else:
		count += data[k] - 1
		drinks += int(data[k] / 2)
		data[k] = 1
if n % 2 == 0:
	count += n / 2 - drinks
else:
	count += int(n / 2) + 1 - drinks
print(int(count))


(n, k) = map(int, input().split())
drinks = [0] * k
for i in range(n):
	liking_drink = int(input()) - 1
	drinks[liking_drink] += 1
lucky = 0
for i in range(k):
	students_who_likes_drink_i = drinks[i]
	lucky += drinks[i] - drinks[i] % 2
	drinks[i] = drinks[i] % 2
losers = sum(drinks)
lucky += losers // 2 + losers % 2
print(lucky)


import sys
import math
(n, k) = sys.stdin.readline().split()
n = int(n)
k = int(k)
aux = {}
arr = []
for i in range(n):
	temp = sys.stdin.readline()
	arr.append(int(temp))
for i in arr:
	if i in aux.keys():
		aux[i] += 1
	else:
		aux[i] = 1
contentos = 0
no_satisfechos = 0
for (key, val) in aux.items():
	if aux[key] % 2 == 0:
		contentos += val
	else:
		contentos += val - 1
		no_satisfechos += 1
if no_satisfechos % 2 == 0:
	contentos += no_satisfechos / 2
else:
	contentos += math.ceil(no_satisfechos / 2)
print(int(contentos))


(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	a[int(input()) - 1] += 1
p = 0
for i in a:
	p += i % 2
print(n - p // 2)


(n, k) = map(int, input().split())
l = []
for i in range(0, n):
	l.append(int(input()))
d = {}
for i in range(1, k + 1):
	d[i] = 0
for i in range(0, n):
	d[l[i]] = d[l[i]] + 1
l = []
for c in d.values():
	l.append(c)
x = 0
for i in range(0, k):
	x = x + l[i] // 2 * 2
	l[i] = l[i] % 2
y = 0
for i in range(0, k):
	if l[i] == 1:
		y += 1
a = y / 2
b = y // 2
if a == b:
	x = x + b
else:
	x = x + b + 1
print(x)


import math
import sys
(npeople, ndrinks) = map(int, sys.stdin.readline().split())
drinks = [0] * ndrinks
for i in range(npeople):
	drink = int(sys.stdin.readline().strip()) - 1
	drinks[drink] += 1
fav = 0
for (i, num) in enumerate(drinks):
	fav += num - num % 2
	drinks[i] = num % 2
if fav < npeople:
	fav += math.ceil((npeople - fav) / 2)
print(fav)


import collections
(n, k) = map(int, input().split())
d = collections.defaultdict(int)
for _ in range(n):
	d[int(input())] += 1
ans = (n + 1) // 2
for x in d.values():
	ans += x // 2
print(ans)


from collections import defaultdict
(n, k) = [int(i) for i in input().split()]
x = []
v = defaultdict(int)
for i in range(n):
	v[int(input())] += 1
a = 0
for i in v.values():
	a += i // 2
print(2 * a + ((n + 1) // 2 - a))


(n, k) = map(int, input().split())
B = []
for i in range(n):
	B.append(int(input()))
A = [0] * k
for i in range(n):
	A[B[i] - 1] += 1
res = 0
for i in range(len(A)):
	if A[i] > 1:
		res += A[i] // 2 * 2
		A[i] = A[i] % 2
res += (sum(A) + 1) // 2
print(res)


(n, k) = map(int, input().split())
l = [0] * 1001
for i in range(n):
	a = int(input())
	l[a] += 1
l.sort(reverse=True)
ans = 0
for i in range(1001):
	ans += l[i] // 2
	l[i] = l[i] % 2
rem = (n + 1) // 2 - ans
ans *= 2
ans += min(rem, sum(l))
print(ans)


import math
S = input()
n = int(S[0:S.find(' ')])
k = int(S[S.find(' ') + 1:len(S)])
A = []
for i in range(0, k):
	A += [0]
for i in range(0, n):
	drink = int(input()) - 1
	A[drink] = A[drink] + 1
ans = math.ceil(n / 2)
for i in range(0, len(A)):
	ans += A[i] // 2
print(ans)


(n, k) = map(int, input().split())
wants = [0] * k
for _ in range(n):
	wants[int(input()) - 1] += 1
unhappy = 0
for w in wants:
	unhappy += w % 2
happy = n - (unhappy + 1) // 2
if n % 2 == 0:
	print(happy)
else:
	print(happy + 1)


(n, d) = map(int, input().split())
a = []
for i in range(n):
	m = int(input())
	a.append(m)
b = list(set(a))
c = []
k = 0
p = 0
t = 0
for i in range(len(b)):
	c.append(a.count(b[i]))
for i in range(len(b)):
	if c[i] % 2 == 0:
		k = k + c[i] / 2
	else:
		t = t + c[i] // 2
		p = p + 1
if n % 2 == 0:
	r = n / 2
else:
	r = n // 2 + 1
if r > k + t:
	print(n - int(p - (r - k - t)))
else:
	print(n - int(p + 2 * (k + t - r)))


import math
(n, k) = map(int, input().strip().split(' '))
lst = []
lst2 = []
for i in range(n):
	t = int(input())
	lst.append(t)
for i in range(1, k + 1):
	lst2.append(lst.count(i))
s = 0
for i in range(k):
	s += lst2[i] // 2
s *= 2
p = s // 2
s += math.ceil((n - s) / 2)
print(s)


s = input().split(' ')
(n, k) = (int(s[0]), int(s[1]))
cnt = [0] * k
for i in range(n):
	x = int(input()) - 1
	cnt[x] += 1
num = (n + 1) // 2
res = 0
for i in range(len(cnt)):
	res += cnt[i] // 2 * 2
	num -= cnt[i] // 2
	cnt[i] = cnt[i] % 2
for i in range(len(cnt)):
	if cnt[i] == 0:
		continue
	if num == 0:
		break
	num -= 1
	res += 1
	cnt[i] = 0
print(res)


s = input()
(n, k) = s.split(' ')
(n, k) = (int(n), int(k))
cnt = [0]
for i in range(k):
	cnt.append(0)
for p in range(n):
	temp = int(input())
	cnt[temp] = cnt[temp] + 1
cnt.sort(reverse=True)
ans = 0
j = 0
if n % 2 != 0:
	n += 1
while j < round(n / 2):
	vari = cnt[0] - 2
	if vari < 0:
		ans = ans + cnt[0]
	else:
		ans = ans + 2
	cnt[0] = cnt[0] - 2
	cnt.sort(reverse=True)
	j += 1
print(ans)


import math

def f(n, k):
	drinks = [0] * (k + 1)
	i = 0
	while i < n:
		drinks[int(input().strip())] += 1
		i += 1
	rem_count = 0
	for i in drinks:
		rem_count += i % 2
	return n - rem_count // 2
(n, k) = map(int, input().strip().split(' '))
print(f(n, k))


ln = [int(i) for i in input().split(' ')]
n = ln[0]
k = ln[1]
ds = []
for i in range(0, n):
	d = int(input())
	ds.append(d)
ds = sorted(ds)
ct = 1
dr = (n + 1) // 2
st = 0
for i in range(1, len(ds)):
	if ds[i] != ds[i - 1]:
		st += ct // 2 * 2
		dr -= ct // 2
		ct = 1
	else:
		ct += 1
st += ct // 2 * 2
dr -= ct // 2
st += dr
print(st)


import math
import heapq
from collections import deque
t = list(map(int, input().split()))
n = t[0]
k = t[1]
my_arr = [0] * 1002
for i in range(n):
	pq = int(input())
	my_arr[pq] = my_arr[pq] + 1
l = []
for i in range(1002):
	if my_arr[i] > 0:
		l.append((my_arr[i], i))
l.sort(reverse=True)
left = 0
used = 0
toggle = 0
for i in range(len(l)):
	val = l[i][0]
	if val % 2 != 0:
		if toggle == 0:
			toggle = 1
		else:
			left = left + 1
			toggle = 0
print(n - left)


a = []
for x in map(int, input().split()):
	a.append(x)
tipe = [0] * (a[1] + 1)
ambil = a[0] // 2
for _ in range(0, a[0]):
	temp = int(input())
	tipe[temp] += 1
tipe.sort()
cek = a[1]
while cek != 0:
	ambil -= tipe[cek] // 2
	cek -= 1
hasil = 0
for i in range(0, a[1] + 1):
	hasil += tipe[i]
print(hasil - ambil)


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, k) = mapin()
d = defaultdict(int)
for i in range(n):
	d[int(input())] += 1
ans = 0
extra = 0
for i in d.values():
	ans += i // 2 * 2
	extra += i % 2
print(ans + (extra + 1) // 2)


import math
inp = list(map(int, input().split()))
n = inp[0]
k = inp[1]
d = {}
num = 0
nsets = 0
faltu = 0
maxi = math.ceil(n / 2)
for x in range(n):
	y = int(input())
	if y in d:
		d[y] += 1
	else:
		d[y] = 1
for key in d:
	if d[key] % 2 == 0:
		num += d[key]
		nsets += d[key] // 2
if nsets < maxi:
	for key in d:
		if d[key] % 2 == 1:
			num += d[key] - 1
			faltu += 1
	num += math.ceil(faltu / 2)
print(num)


(n, k) = map(int, input().split())
arr = list()
for i in range(n):
	temp = int(input())
	arr.append(temp)
s = set(arr)
count_arr = list()
for ele in s:
	count_arr.append(arr.count(ele))
sets = (n + 1) // 2
i = 0
while i < len(count_arr):
	sets -= count_arr[i] // 2
	count_arr[i] = count_arr[i] % 2
	i += 1
i = 0
while sets != 0:
	sets -= count_arr[i]
	count_arr[i] -= 1
	i += 1
print(n - count_arr.count(1))


(n, k) = map(int, input().split())
j = n // 2
if n % 2 > 0:
	j += 1
a = []
for _ in range(0, n):
	a.append(int(input()))
a_sorted = []
for __ in range(1, k + 1):
	a_sorted.append(a.count(__))
result = []
for ___ in a_sorted:
	y = ___ // 2
	if ___ % 2 > 0:
		y += 1
	result.append(y)
p = sum(result) - j
if p >= 0:
	print(n - p)
else:
	print(n)


from collections import Counter
import math
(n, k) = map(int, input().split())
l1 = []
for i in range(n):
	v = int(input())
	l1.append(v)
dict1 = Counter(l1)
sum1 = 0
for i in dict1.values():
	sum1 += math.ceil(i / 2)
d = abs(sum1 - math.ceil(n / 2))
print(n - d)


import math
(n, k) = [int(i) for i in input().split()]
d = [0 for i in range(1, k + 1)]
for i in range(n):
	qwe = int(input())
	d[qwe - 1] += 1
hd = 0
un = 0
for i in d:
	hd += i // 2
	un += i % 2
hd = hd * 2 + (math.ceil(n / 2) - hd)
print(hd)


(n, k) = [int(i) for i in input().split()]
napitki_count = [0 for i in range(k + 1)]
for i in range(n):
	a = int(input())
	napitki_count[a] += 1
napitki_count = napitki_count[1:]
n_naborov = n // 2
satisfied = 0
remaining = 0
for i in napitki_count:
	n_naborov -= i // 2
	satisfied += i // 2 * 2
	remaining += i % 2
satisfied += n_naborov
if n % 2 == 0:
	print(satisfied)
else:
	print(satisfied + 1)


from math import ceil
(n, k) = map(int, input().split())
drinks = [False for i in range(k + 1)]
satisfied = 0
for i in range(n):
	d = int(input())
	if drinks[d]:
		satisfied += 2
	drinks[d] = not drinks[d]
unsat = len(list(filter(lambda x: x, drinks)))
print(satisfied + ceil(unsat / 2))


(n, k) = map(int, input().split(' '))
a = []
count = [0] * 1001
res = 0
flag = 0
odd = 0
for i in range(n):
	temp = int(input())
	a.append(temp)
	count[temp] += 1
for i in range(len(count)):
	res += count[i] - count[i] % 2
	if count[i] % 2 == 1:
		flag = 1
		odd += 1
res += odd // 2
res += odd % 2
print(res)


(n, k) = map(int, input().split())
a = [0] * k
for _ in range(n):
	a[int(input()) - 1] += 1
num = 0
for i in a:
	num += 2 * (i // 2)
print(num + (n - num + 1) // 2)


import math
(n, k) = map(int, input().split())
a = {}
for _ in range(n):
	x = int(input())
	a[x] = a.get(x, 0) + 1
count = 0
for (key, val) in a.items():
	count += val // 2 * 2
count = count + math.ceil((n - count) / 2)
print(count)


import sys
import math
import collections
n = list(map(int, input().split(' ')))
a = list(map(int, sys.stdin.readlines()))
d = collections.Counter(a)
c = 0
for i in range(math.ceil(n[0] / 2)):
	v = list(d.values())
	k = list(d.keys())
	m = k[v.index(max(v))]
	if d[m] < 2:
		d[m] -= 1
		c += 1
	else:
		d[m] -= 2
		c += 2
print(c)


import sys
(n, k) = list(map(int, sys.stdin.readline().strip().split()))
A = [0] * (k + 1)
for i in range(0, n):
	a = int(sys.stdin.readline().strip())
	A[a] = A[a] + 1
x = 0
y = 0
for i in range(1, k + 1):
	x = x + A[i] // 2
	y = y + A[i] % 2
print(2 * x + (y + 1) // 2)


import atexit
import io
import sys
R = lambda : map(int, input().split())
(n, k) = R()
d = {}
for i in range(n):
	temp = int(input())
	if temp in d:
		d[temp] += 1
	else:
		d[temp] = 1
cnt = 0
ans = 0
for i in d:
	cnt += d[i] % 2
	ans += d[i] // 2 * 2
ans += (cnt + 1) // 2
print(ans, flush=True)


import math
(n, k) = map(int, input().split())
m = {}
for i in range(n):
	a = int(input())
	if a in m:
		m[a] += 1
	else:
		m[a] = 1
ans = 0
o = 0
for i in m:
	ans += m[i] // 2
	o += m[i] % 2
os = math.ceil(n / 2) - ans
print(min(ans * 2 + os, n))


import math
L = []
M = []
N = []
S = 0
numbers = list(map(int, input().split()))
for i in range(numbers[0]):
	x = input()
	x = int(x)
	L.append(x)
for j in range(numbers[1]):
	M.append(0)
	N.append(0)
for j in range(len(L)):
	M[L[j] - 1] = M[L[j] - 1] + 1
for i in range(len(M)):
	S = S + math.floor(M[i] / 2)
X = math.ceil(numbers[0] / 2) - S
print(S * 2 + X)


import math
(n, k) = [int(x) for x in input().split()]
l = []
for i in range(n):
	l.append(int(input()))
sets = math.ceil(n / 2)
d = {}
for elems in l:
	if elems not in d:
		d[elems] = 1
	else:
		d[elems] += 1
x = sets
for z in range(sets):
	for keys in d:
		if d[keys] >= 2:
			d[keys] -= 2
			x -= 1
			break
for y in range(x):
	for keys in d:
		if d[keys] == 1:
			d[keys] -= 1
			break
summ = 0
for key in d:
	summ += d[key]
print(n - summ)


(n, k) = map(int, input().split())
x = n // 2
if n % 2 != 0:
	x = x + 1
a = {}
for i in range(1, k + 1):
	a[i] = 0
for i in range(n):
	y = int(input())
	a[y] += 1
res = 0
c = 0
for i in range(1, k + 1):
	if a[i] % 2 == 0:
		res = res + a[i] // 2
	else:
		res = res + a[i] // 2
		c += 1
y = x - res
print(res * 2 + y)


(n, k) = list(map(int, input().split()))
d = {}
for _ in range(n):
	t = int(input())
	d[t] = d.get(t, 0) + 1
k = [i % 2 for i in d.values()]
print(n - k.count(1) // 2)


(n, k) = map(int, input().split())
from collections import defaultdict as dd
from math import ceil
d = dd(int)
ans = 0
for i in range(n):
	x = int(input())
	d[x] += 1
r = ceil(n / 2)
r2 = r
a = list(d.values())
for i in a:
	if 2 * r >= i:
		if i % 2 == 0:
			ans += i
		else:
			ans += i - 1
	r -= i // 2
rem = r2 - ans // 2
print(ans + rem)


from collections import defaultdict
(n, k) = map(int, input().strip().split())
nums = []
for i in range(n):
	nums.append(int(input().strip()))
num_dict = defaultdict(int)
for i in nums:
	num_dict[i] += 1
num_set = set()
ans = 0
for i in num_dict:
	if num_dict[i] % 2 == 0:
		ans += num_dict[i]
	else:
		num_set.add(i)
nums_new = sorted(num_set, key=lambda x: num_dict[x], reverse=True)
index = n
remain = 0
ptr = 0
while ptr < len(num_set):
	ans += num_dict[nums_new[ptr]] - remain
	if (num_dict[nums_new[ptr]] + remain) % 2 != 0:
		remain = 1
	else:
		remain = 0
	ptr += 1
print(ans)


(n, k) = map(int, input().split())
array = []
for i in range(n):
	array.append(int(input()))
nabor = n // 2 if n % 2 == 0 else n // 2 + 1
array = sorted(array)
lenght = len(array)
nab = nabor
delet = 1
digit = [0] * k
counter = 0
for i in range(k):
	for j in range(len(array)):
		if array[j] == i + 1:
			digit[i] += 1
for i in range(k):
	counter += digit[i] // 2
if nabor > counter:
	print(counter * 2 + nabor - counter)
	exit()
if nabor == counter:
	print(counter * 2)
	exit()
if nabor < counter:
	print(counter * 2)
	exit()


(n, k) = map(int, input().split())
d = [0] * (k + 1)
x = (n + n % 2) // 2
for _ in range(n):
	i = int(input())
	d[i] += 1
odd = [d[i] for i in range(1, k + 1) if d[i] % 2 == 1]
ans = n - len(odd) // 2
print(ans)


from math import ceil
inp = input().split(' ')
n = int(inp[0])
k = int(inp[1])
wait = []
pairs = 0
for i in range(n):
	a = input()
	if a in wait:
		wait.remove(a)
		pairs += 1
	else:
		wait.append(a)
print(pairs * 2 + (ceil(n / 2) - pairs))


import math
(n, k) = map(int, input().split())
fav_drinks = {}
for _ in range(n):
	x = int(input())
	if x not in fav_drinks:
		fav_drinks[x] = 1
	else:
		fav_drinks[x] += 1
no_of_fullset = 0
no_of_halfset = 0
for drink in fav_drinks:
	if fav_drinks[drink] % 2:
		no_of_halfset += fav_drinks[drink] % 2
	no_of_fullset += int(fav_drinks[drink] / 2)
if no_of_halfset % 2:
	no_of_halfset += 1
result = no_of_fullset * 2 + int(no_of_halfset / 2)
print(result)


from collections import Counter
import math
v = [0] * 1000
(x, y) = map(int, input().split())
for i in range(x):
	t = int(input())
	v[t - 1] += 1
cnt = 0
for i in range(1000):
	if v[i] % 2 != 0:
		cnt += 1
print(x - (cnt - math.ceil(cnt / 2)))


import math

class Max_Heap:

	def __init__(self, heap_in=None):
		if heap_in == None:
			self.heap = []
			self.len = 0
		else:
			self.heap = heap_in
			self.len = len(heap_in)

	def parent(self, k):
		return (k - 1) // 2

	def children(self, k):
		return (2 * k + 1, 2 * k + 2)

	def insert(self, data):
		self.heap.append(data)
		self.len += 1
		self.swim(self.len - 1)

	def compare(self, parent, child):
		if self.heap[parent] > self.heap[child]:
			return True
		else:
			return False

	def exchange(self, parent, child):
		(self.heap[parent], self.heap[child]) = (self.heap[child], self.heap[parent])

	def swim(self, k):
		while k > 0 and (not self.compare(self.parent(k), k)):
			self.exchange(self.parent(k), k)
			k = (k - 1) // 2

	def retmax(self):
		return self.heap[0]

	def sink(self, k):
		while (2 * k + 1 and 2 * k + 2) < self.len:
			child = 2 * k + 1
			if child < self.len - 1 and self.heap[child] < self.heap[child + 1]:
				child += 1
			if self.compare(k, child):
				break
			self.exchange(k, child)
			k = child
		else:
			if 2 * k + 2 >= self.len and 2 * k + 1 < self.len:
				child = 2 * k + 1
				if not self.compare(k, child):
					self.exchange(k, child)
				return

	def delmax(self):
		if self.len == 1:
			self.len -= 1
			return self.heap.pop()
		maxroot = self.heap[0]
		self.exchange(0, self.len - 1)
		self.heap.pop()
		self.len -= 1
		self.sink(0)
		return maxroot

class Obj:

	def __init__(self, i, v):
		self.i = i
		self.v = v

	def __gt__(self, other):
		return self.v > other.v

	def __lt__(self, other):
		return self.v < other.v
(n, k) = map(int, input().split(' '))
mp = {}
for _ in range(n):
	t = int(input())
	if t in mp:
		mp[t] += 1
	else:
		mp[t] = 1
heap = Max_Heap()
for (key, val) in mp.items():
	heap.insert(Obj(key, val))
(res, c) = (0, math.ceil(n / 2))
while heap.heap and c:
	if heap.retmax().v >= 2:
		val = heap.delmax()
		res += val.v // 2 * 2
		c -= val.v // 2
		if val.v % 2:
			heap.insert(Obj(val.i, val.v % 2))
	else:
		res += 1
		c -= 1
		heap.delmax()
print(res)


(n, k) = map(int, input().split())
s = {}
for K in range(1, k + 1):
	s.update({K: 0})
for _ in range(n):
	drink = int(input())
	s[drink] += 1
odd = 0
for K in range(1, k + 1):
	if not s[K] % 2 == 0:
		odd += 1
print(n - int(odd / 2))


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
(n, k) = invr()
fre = [0] * 1005
for i in range(n):
	x = inp()
	fre[x] += 1
ans = 0
baki = 0
for i in range(k + 1):
	ans += fre[i] // 2 * 2
	if fre[i] % 2:
		baki += 1
if baki % 2:
	baki += 1
ans += baki // 2
print(ans)


(n, k) = input().split()
n = int(n)
k = int(k)
a = []
l = 0
for i in range(n):
	x = int(input())
	a.append(x)
s = set(a)
for i in s:
	p = a.count(i)
	if p % 2 == 1:
		l += 1
if n % 2 != 0:
	s = n - l // 2
else:
	s = n - l // 2
print(s)


from collections import Counter
(n, k) = list(map(int, input().split()))
l = [0 for i in range(k)]
for i in range(n):
	l[int(input()) - 1] += 1
l.sort(reverse=True)
odd = 0
for i in l:
	if i & 1:
		odd += 1
if n & 1:
	odd -= 1
print(n - odd // 2)


import math
(x, y) = map(int, input().strip().split())
a = [0] * y
b = math.ceil(x / 2)
op = 0
for i in range(x):
	ip = int(input())
	a[ip - 1] += 1
	if a[ip - 1] == 2:
		op = op + 2
		a[ip - 1] = 0
print(op + (b - op // 2))


(n, k) = input().split()
(n, k) = (int(n), int(k))
i = 0
a = []
while i < n:
	x = int(input())
	a.append(x)
	i += 1
a.sort()
(x, od, prei, con, cn) = (0, 0, 0, False, 1)
for i in a:
	if x == 0:
		pass
	elif i == prei:
		cn += 1
	else:
		od += cn % 2
		cn = 1
	if x == n - 1:
		od += cn % 2
	x += 1
	prei = i
if n % 2 == 1:
	print(n - (od - 1) // 2)
else:
	print(n - od // 2)


def gns():
	return list(map(int, input().split()))
(n, k) = gns()
ks = [0] * k
for i in range(n):
	x = int(input()) - 1
	ks[x] += 1
ans = 0
for i in range(k):
	ans += ks[i] // 2 * 2
re = n - ans
print(ans + (re + 1) // 2)


a = list(map(int, input().split()))
n = a[0]
k = a[1]
i = 0
a = [0 for j in range(k)]
while i < n:
	inp = int(input())
	a[inp - 1] += 1
	i += 1
i = 0
even = 0
ker = 0
while i < k:
	even += a[i - 1] // 2
	i += 1
if n % 2 == 1:
	ker = n // 2 + 1
else:
	ker = n // 2
print(int(2 * even + ker - even))


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


from itertools import *
from collections import Counter

def line():
	inp = input().split()
	if len(inp) == 1:
		return int(inp[0])
	return map(int, inp)
(n, k) = line()
a = Counter((line() for _ in repeat(None, n))).values()
(happy, sad) = (0, 0)
for m in a:
	happy += m - m % 2
	sad += m % 2
print(happy + sad // 2 + sad % 2)


(n, k) = tuple(map(int, input().split()))
a = [0] * k
for i in range(n):
	inp = int(input())
	a[inp - 1] += 1
ans = 0
for i in range(k):
	ans += a[i] - a[i] % 2
	a[i] %= 2
c = a.count(1)
print(ans + c // 2 + c % 2)


from math import ceil
from collections import Counter as c
(n, k) = map(int, input().split())
m = len(list(filter(lambda x: x % 2 != 0, c([int(input()) for i in range(n)]).values())))
print(n - m // 2)


from math import ceil
(n, k) = map(int, input().split())
d = {}
for _ in range(n):
	num = int(input())
	d[num] = d.get(num, 0) + 1
ans = 0
count = 0
for x in d.values():
	if x % 2 == 0:
		ans += x
	else:
		ans += x - 1
		count += 1
print(ans + ceil(count / 2))


from collections import Counter
(n, k) = map(int, input().split())
count = Counter(range(1, k + 1))
for i in range(n):
	count[int(input())] += 1
count = len(list(filter(lambda x: count[x] % 2 == 0, count)))
print(n - count // 2)


import sys
from collections import defaultdict

def main():
	(n, k) = map(int, input().split())
	d = defaultdict(int)
	for _ in range(n):
		d[int(input())] += 1
	sets = (n + 1) // 2
	res = 0
	left = 0
	for (k, v) in d.items():
		if v % 2 == 0:
			res += v
			sets -= v // 2
		else:
			left += 1
			res += v - 1
			sets -= v // 2
	while left > 0 and sets > 0:
		left -= 1
		sets -= 1
		res += 1
	print(res)
main()


(n, k) = map(int, input().split())
l = []
for _ in range(n):
	l.append(int(input()))
r = []
for i in range(1, k + 1):
	r.append(l.count(i))
c = 0
for i in r:
	if i % 2 == 1:
		c += 1
print(n - c // 2)


from collections import Counter
(n, k) = map(int, input().split())
l = [int(input()) for _ in range(n)]
cnt = Counter(l)
res = n
bad = 0
for v in cnt.values():
	if v & 1:
		bad += 1
res -= bad // 2
print(res)


from collections import Counter

def solve(n, k, a):
	c = Counter(a)
	r = 0
	rests = 0
	for (k, v) in c.items():
		r += v // 2 * 2
		rests += v % 2
	return r + (rests + 1) // 2
(n, k) = map(int, input().split())
a = []
for _ in range(n):
	a.append(int(input()))
r = solve(n, k, a)
print(r)


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

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
(n, k) = ri()
a = []
c = dd(int)
for i in range(n):
	temp = ri(1)
	c[temp] += 1
ans = 0
rem = 0
for i in c:
	ans += c[i] // 2 * 2
	rem += c[i] % 2
print(ans + rem // 2 + rem % 2)


(n, k) = map(int, input().split())
counts = [0] * k
for _ in range(n):
	counts[int(input()) - 1] += 1
result = 0
odds = 0
for c in counts:
	result += 2 * (c // 2)
	odds += c % 2
result += (odds + 1) // 2
print(result)


(n, k) = map(int, input().split())
c = {}
for _ in range(n):
	x = int(input())
	c[x] = c.get(x, 0) + 1
a = 0
for x in c.values():
	a += x % 2
if n % 2:
	a -= 1
a = max(0, (a + 1) // 2)
print(n - a)


(n, k) = map(int, input().split())
a = [int(input()) for i in range(n)]
b = [0 for i in range(k)]
for i in range(k):
	b[i] = a.count(i + 1)
num = (n - 1) // 2 + 1
r = 0
for i in range(k):
	if b[i] % 2 == 0:
		r += b[i]
		num -= b[i] // 2
		b[i] = 0
	else:
		r += b[i] - 1
		num -= b[i] // 2
		b[i] = 1
r += num
print(r)


drinks = []
r = 0
(students, ndrinks) = map(int, input().split())
for i in range(students):
	drinks.append(int(input()))
for i in range(ndrinks):
	x = drinks.count(i + 1)
	if x % 2 == 1:
		r += 1
if students % 2 == 1:
	print(int(students - (r - 1) / 2))
else:
	print(int(students - r / 2))


nk = [int(x) for x in input().split()]
n = nk[0]
k = nk[1]
favs = []
types = 0
cnt = {}
for i in range(n):
	a = int(input())
	favs.append(a)
	if a not in cnt:
		cnt[a] = 0
		types += 1
	cnt[a] += 1
num = 0
mrdk = 0
for (k, v) in cnt.items():
	num += cnt[k] // 2 * 2
	mrdk += cnt[k] % 2
tmp = num
while tmp < n:
	tmp += 2
	num += 1
print(num)


(n, k) = input().split()
n = int(n)
l = 0
if n % 2 == 0:
	p = n // 2
else:
	p = n // 2 + 1
k = int(k)
a = [0] * k
for x in range(n):
	temp = int(input())
	a[temp - 1] = a[temp - 1] + 1
for x in range(k):
	p = p - a[x] // 2
	l = l + a[x] // 2 * 2
	a[x] = a[x] - a[x] // 2 * 2
print(l + p)


import math
import sys
from collections import Counter

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

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

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

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

def li():
	return list(map(int, input().split()))
(n, k) = mi()
d = getdict(n)
r = sum([i % 2 for i in d.values()])
t = cdiv(n, 2)
print(n - r + t - (n - r) // 2)


from collections import deque, Counter
from itertools import combinations, permutations
from math import sqrt
import unittest

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

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
(n, k) = read_int_array()
types = []
for _ in range(n):
	types += [read_int()]
odds = Counter(types)
odds_num = sum((1 for (t, num) in odds.items() if num % 2 == 1))
print(n - odds_num // 2)


(n, k) = map(int, input().split())
m = n // 2 + n % 2
a = [0] * (n + 1)
d = [0] * (k + 1)
for i in range(1, 1 + n):
	x = int(input())
	a[i] = x
	d[x] += 1
a.sort()
d.sort()
ans = 0
for i in d[::-1]:
	if i % 2 == 0:
		y = i // 2
		if y <= m:
			ans += y * 2
			m -= y
		else:
			ans += m * 2
			m = 0
			break
if m > 0:
	for i in range(len(d) - 1, 0, -1):
		if d[i] % 2:
			y = d[i] // 2
			if y <= m:
				ans += y * 2
				m -= y
				d[i] -= y * 2
			else:
				ans += m * 2
				m = 0
if m > 0:
	for i in range(len(d)):
		if d[i] == 1:
			ans += 1
			m -= 1
			if m == 0:
				break
print(ans)


import math
(n, k) = [int(i) for i in input().split()]
nabors = [0] * k
am = math.ceil(n / 2)
p = 0
for i in range(n):
	x = int(input())
	nabors[x - 1] += 1
p = 0
for i in range(k):
	p += nabors[i] % 2
print(math.ceil(n - p / 2))


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

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

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	t = 1
	for tt in range(t):
		(n, k) = num()
		a = []
		ff = [0] * (k + 1)
		for i in range(n):
			a.append(nu())
			ff[a[i]] += 1
		ff.sort(reverse=True)
		zz = 0
		pp = 0
		i = 0
		while i <= k:
			if ff[i] == 0:
				break
			zz += ff[i] // 2
			pp += ff[i] % 2
			i += 1
		print(zz * 2 + pp // 2 + (1 if n % 2 == 1 else 0))
solve()


(n, k) = input().split(' ')
n = int(n)
k = int(k)
j = []
for i in range(0, n):
	j.append(int(input()))
q = []
for i in range(0, k):
	q.append(0)
for i in range(0, n):
	q[j[i] - 1] += 1
ans = 0
l = 0
loopEnd = 0
if 1 == n % 2:
	loopEnd = int(n / 2) + 1
else:
	loopEnd = int(n / 2)
for i in range(0, loopEnd):
	q.sort()
	q.reverse()
	if q[l] > 2:
		ans += 2
		q[0] = q[0] - 2
	else:
		ans += q[0]
		q[0] = 0
print(int(ans))


(n, k) = map(int, input().split())
a = [0] * n
for i in range(n):
	a[i] = int(input())
a.sort()
g = 0
e = 0
i = 0
while i < len(a):
	if i == len(a) - 1:
		e += 1
		break
	if a[i] == a[i + 1]:
		g += 1
		i += 2
		continue
	e += 1
	i += 1
ans = 0
if e % 2 == 0:
	ans = 2 * g + e // 2
else:
	ans = 2 * g + (e + 1) // 2
print(ans)


def tianjia(dic, n):
	if n in dic:
		dic[n] += 1
	else:
		dic[n] = 1
(n, k) = list(map(int, input().split()))
l = []
for _ in range(n):
	l.append(int(input()))
dic = {}
for i in l:
	tianjia(dic, i)
su = 0
for i in dic:
	if dic[i] & 1:
		su += 1
if su & 1:
	print(n - (su - 1) // 2)
else:
	print(n - su // 2)


(n, k) = list(map(int, input().split()))
dic = {}
for i in range(n):
	num = int(input())
	if num in dic.keys():
		dic[num] += 1
	else:
		dic[num] = 1
odd = 0
for value in dic.values():
	if value % 2:
		odd += 1
if odd == 0:
	print(n)
else:
	ans = odd // 2
	print(n - ans)


import math
(n, k) = map(int, input().split())
a = [0] * (k + 1)
b = math.ceil(n / 2)
l = 0
d = 0
for i in range(n):
	c = int(input())
	a[c] += 1
	if a[c] == 2:
		d += 2
		l += 1
		a[c] -= 2
		if l == b:
			break
if l >= b:
	print(d)
else:
	print(d + b - l)


import math

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

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

def ii():
	return int(input())
a = {}
(n, k) = mi()
for i in range(1, k + 1):
	a[i] = 0
for i in range(n):
	p = ii()
	a[p] += 1
x = math.ceil(n / 2)
c = 0
ans = 0
for i in range(1, k + 1):
	c += a[i] % 2
	if a[i] // 2:
		r = a[i] // 2
		x -= r
		ans += 2 * r
print(ans + x)


from math import ceil
(n, k) = map(int, input().split())
arr = [0] * k
for _ in range(n):
	a = int(input())
	arr[a - 1] += 1
i = 0
c = 2
for j in range(ceil(n / 2)):
	while i < len(arr) and arr[i] < c:
		i += 1
	if i < len(arr):
		arr[i] -= c
	elif c == 2:
		i = 0
		c = 1
		while i < len(arr) and arr[i] < c:
			i += 1
		if i < len(arr):
			arr[i] -= c
	else:
		break
print(n - sum(arr))


(n, k) = map(int, input().split())
canuse_set = -(-n // 2)
num = []
new = []
count = 0
got = 0
for i in range(n):
	num.append(int(input()))
for i in range(1, k + 1):
	count = num.count(i)
	if count % 2 == 0:
		canuse_set -= count // 2
		got += count
	else:
		canuse_set -= count // 2
		got += count - 1
		new.append(i)
while canuse_set:
	got += 1
	canuse_set -= 1
print(got)


(n, k) = map(int, input().split())
final_answer = 0
odds = 0
drinks = {}
types_of_drinks = []
for _ in range(n):
	x = int(input())
	if x not in drinks:
		drinks[x] = 1
		types_of_drinks.append(x)
	else:
		drinks[x] += 1
for elem in types_of_drinks:
	if drinks[elem] % 2 == 0:
		final_answer += drinks[elem]
	else:
		odds += 1
		final_answer += drinks[elem] - 1
final_answer = final_answer + (odds + 1) // 2
print(final_answer)


from sys import stdin, stdout
(n, k) = map(int, input().split())
cnt = [0 for i in range(k)]
for i in stdin.readlines():
	cnt[int(i) - 1] += 1
ans = 0
f = True
for i in cnt:
	ans += i - (i & 1)
	if i & 1 and f:
		f = False
		ans += 1
	elif i & 1:
		f = True
print(ans)


import math
import collections
(n, k) = input().split()
(n, k) = [int(n), int(k)]
a = []
for i in range(0, n):
	a.append(int(input()))
a.sort()
m = math.ceil(n / 2)
d = collections.Counter(a)
ans = 0
for i in set(a):
	if d[i] >= 2:
		ans += 2
		m -= 1
	if m == 0:
		break
	t = d[i] // 2
	t -= 1
	if m >= t and t > 0:
		ans += 2 * t
		m = m - t
	elif t > 0:
		ans += 2 * m
		m = 0
	if m == 0:
		break
while m != 0:
	m -= 1
	ans += 1
print(ans)


(n, k) = map(int, input().split())
dict1 = {}
for i in range(n):
	x = int(input())
	try:
		dict1[x] += 1
	except:
		KeyError
		dict1[x] = 1
ans = 0
flagcount = 0
for i in dict1.keys():
	ans += dict1[i] // 2 * 2
	if dict1[i] % 2 != 0:
		flagcount += 1
if n % 2 == 0:
	ans += flagcount // 2
else:
	ans += flagcount // 2
	ans += 1
print(ans)


import time
(n, k) = (int(i) for i in input().split())
start = time.time()
b = [0 for i in range(k)]
for i in range(n):
	now = int(input()) - 1
	b[now] += 1
ost = 0
ans = 0
for i in range(k):
	d = b[i] % 2
	ans += b[i] - d
	ost += d
ans += ost // 2 + ost % 2
print(ans)
finish = time.time()


(n, k) = [int(i) for i in input().split()]
dic = [0] * (k + 1)
for j in range(n):
	a = int(input())
	dic[a] += 1
sets = 0
for d in dic:
	sets += d // 2
tot = (n + 1) // 2
print(sets + tot)


from math import ceil
(n, k) = map(int, input().split())
l = [0] * (k + 1)
t = 0
c = ceil(n / 2)
for i in range(n):
	a = int(input())
	l[a] += 1
	if l[a] == 2 and c != 0:
		l[a] = 0
		c -= 1
		t += 2
for i in range(k + 1):
	if c == 0:
		break
	elif l[i] == 1:
		c -= 1
		t += 1
print(t)


import sys
import math
input = sys.stdin.readline
(n, k) = map(int, input().split())
arr = [0] * k
for i in range(n):
	arr[int(input()) - 1] += 1
count = 0
for i in range(k):
	if arr[i] % 2 == 1:
		count += 1
print(n - count // 2)


t = 1
while t:
	t = t - 1
	(n, k) = map(int, input().split())
	arr = [0 for i in range(k)]
	for j in range(n):
		w = int(input())
		arr[w - 1] += 1
	codd = 0
	ceven = 0
	for w in arr:
		if w % 2 == 1:
			codd += 1
		else:
			ceven += 1
	if codd == 0:
		print(n)
	else:
		print(n - codd // 2)


(n, k) = map(int, input().split())
d = {}
for i in range(n):
	x = int(input())
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
c = 0
o = 0
for x in d:
	if d[x] % 2 == 0:
		c += d[x]
	else:
		c += d[x] - 1
		o += 1
if o % 2 == 0:
	c += o // 2
else:
	c += o // 2 + 1
print(c)


(a, b) = map(int, input().split())
if a % 2 == 0:
	sets = a // 2
else:
	sets = a // 2 + 1
dic = {}
for i in range(a):
	m = int(input())
	if m in dic:
		dic[m] += 1
	else:
		dic[m] = 1
l = []
for i in dic:
	l.append(dic[i])
l.sort()
i = len(l) - 1
z = 0
count = 0
while i >= 0 and sets > 0:
	if l[i] >= 2:
		c = l[i] // 2
		if sets >= c:
			count += l[i] // 2 * 2
			l[i] = l[i] % 2
			z += l[i]
			sets -= c
		else:
			count += sets * 2
			l[i] = l[i] - sets * 2
			z += l[i]
			sets = 0
	else:
		z += l[i]
	i -= 1
if sets > 0 and z > 0:
	count += min(z, sets)
print(count)


n = int(input().split()[0])
c = [0] * 1001
for _ in [0] * n:
	c[int(input())] += 1
print(n - sum((x % 2 for x in c)) // 2)


line = input().split()
n = int(line[0])
k = int(line[1])
freq = [0 for i in range(k + 1)]
for i in range(n):
	x = int(input())
	freq[x] += 1
ans = 0
g = (n + 1) // 2
for i in range(k + 1):
	cnt = freq[i] // 2
	ans += cnt * 2
	g -= cnt
	freq[i] %= 2
for i in range(k + 1):
	if g == 0:
		break
	if freq[i] == 1:
		g -= 1
		ans += 1
print(ans)


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

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

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

def input():
	return sys.stdin.readline().strip()
(n, k) = get_ints()
drinks = ceil(n / 2)
mydict = dict()
for i in range(n):
	z = int(input())
	mydict[z] = mydict.get(z, 0) + 1
used = 0
for i in range(drinks):
	c = -1
	maxi = -1
	for i in mydict:
		if mydict[i] > maxi:
			c = i
			maxi = mydict[i]
	if mydict[c] > 2:
		mydict[c] -= 2
		used += 2
	else:
		used += mydict[c]
		del mydict[c]
print(used)


from math import *
(n, k) = map(int, input().split())
a = [0] * (k + 1)
for i in range(n):
	x = int(input())
	a[x] += 1
k *= 2
count = 0
for i in a:
	if i % 2 != 0:
		count += 1
print(n - count // 2)


from math import *
(n, k) = map(int, input().split())
ls = []
c = ceil(n / 2)
for i in range(n):
	ls.append(int(input()))
d = dict()
d[0] = 0
for i in range(k):
	d[i + 1] = ls.count(i + 1)
a = sorted(d.items(), key=lambda x: x[1])
count = 0
for i in a:
	if i[1] % 2 != 0:
		count += 1
print(n - count // 2)


(N, K) = [int(x) for x in input().split()]
L = [0] * (K + 1)
for i in range(N):
	L[int(input())] += 1
x = 0
for i in range(1, K + 1):
	x += L[i] // 2
	L[i] = L[i] % 2
Sum = sum(L)
if N % 2 == 1:
	print(N - (Sum - ((N + 1) // 2 - x)))
else:
	print(N - (Sum - (N // 2 - x)))


try:
	while True:
		(n, k) = map(int, input().split())
		good = bad = 0
		a = [0] * 1005
		for _ in range(n):
			x = int(input())
			a[x] += 1
		for i in range(1, k + 1):
			good += a[i] & (1 << 31) - 2
			bad += a[i] & 1
		print(good + (bad + 1 >> 1))
except EOFError:
	pass


(n, k) = map(int, input().split())
cnt = [0] * (k + 1)
for _ in range(n):
	tmp = int(input())
	cnt[tmp] += 1
tmp = 0
for val in cnt:
	if val % 2 == 1:
		tmp += 1
ans = n - tmp // 2
print(ans)


from collections import defaultdict
(n, k) = map(int, input().split())
d = defaultdict(int)
for i in range(n):
	d[int(input())] += 1
ans = 0
sett = (n + 1) // 2
cnt = 0
for i in d:
	if d[i] % 2 == 0:
		sett -= d[i] // 2
	else:
		cnt += 1
		sett -= d[i] // 2
print(min(n, n - (cnt - sett)))


(n, k) = map(int, input().split())
d = {}
for i in range(n):
	x = int(input())
	if x not in d:
		d[x] = 0
	d[x] += 1
l = list(d.values())
(ans, p) = (0, (n + (n & 1)) // 2)
l.sort()
while l[-1] > 1:
	l[-1] -= 2
	ans += 2
	p -= 1
	l.sort()
print(ans + p)


(n, k) = map(int, input().split())
cnt = [0] * k
for i in range(n):
	x = int(input())
	cnt[x - 1] += 1
ans = 0
p = 0
for i in range(k):
	p += cnt[i] // 2
	ans += cnt[i] // 2 * 2
ans += (n + 1) // 2 - p
print(ans)


r = input().split(' ')
n = int(r[0])
k = int(r[1])
t = 0
f = 0
d = {}
for i in range(n):
	a = int(input())
	if a not in d:
		d[a] = 1
	else:
		d[a] += 1
for i in d:
	if d[i] % 2 == 1:
		if t > 0:
			t -= 1
			f += 1
		else:
			t += 1
print(n - f)


(n, k) = map(int, input().split())
l = []
x = []
p = int((n + 1) / 2)
sum = 0
for i in range(n):
	l.append(int(input()))
for i in range(k):
	x.append(l.count(i + 1))
	sum += int(x[i] / 2)
print(p - sum + sum * 2)


(n, k) = [int(i) for i in input().split()]
s = [0] * k
for i in range(n):
	s[int(input()) - 1] += 1
p = 0
for i in s:
	p += i % 2
print(n - p // 2)


from sys import stdin, stdout
from collections import Counter

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	(n, k) = rmult_int()
	prefs = []
	for i in range(n):
		prefs.append(rsingle_int())
	count_prefs = Counter(prefs)
	uneven_cnts = 0
	for key in count_prefs:
		if count_prefs[key] % 2 != 0:
			uneven_cnts += 1
	if uneven_cnts % 2 != 0:
		uneven_cnts -= 1
	unsatisfied = int(uneven_cnts / 2)
	print(n - unsatisfied)
main()


(n, k) = map(int, input().split())
z = [0 for i in range(k)]
for i in range(n):
	a = int(input())
	z[a - 1] += 1
z.sort()
i = 0
if n % 2 == 1:
	n += 1
f = n // 2
summ = 0
for i in range(k):
	if z[i] % 2 == 1:
		z[i] -= 1
	summ += z[i]
	f -= z[i] // 2
	i += 1
summ += f
print(summ)


iarr = list(map(int, input().split()))
n = iarr[0]
k = iarr[1]
arr = [0 for i in range(k + 1)]
if n % 2 == 1:
	m = n // 2 + 1
else:
	m = n // 2
for i in range(n):
	ai = int(input())
	arr[ai] += 1
ans = 0
for i in range(1, k + 1):
	m -= arr[i] // 2
	ans += arr[i] // 2 * 2
if m > 0:
	ans += 1
	m -= 1
print(ans + m)


(q, w) = map(int, input().split())
e = (q + 1) // 2
r = [0] * w
t = 0
y = 0
for i in range(q):
	r[int(input()) - 1] += 1
for i in range(len(r)):
	t += r[i] % 2
	y += r[i] // 2 * 2
y += (t + 1) // 2
print(y)


def main():
	(n, k) = map(int, input().split())
	k = int(int(n / 2) + n % 2)
	count = {}
	for i in range(n):
		a = int(input())
		count[a] = count.get(a, 0) + 1
	res = 0
	for x in count:
		if k > int(count[x] / 2):
			k -= int(count[x] / 2)
			res += count[x] - count[x] % 2
			count[x] = count[x] % 2
		else:
			res += 2 * k
			k = 0
			break
	if k > 0:
		res += min(k, sum(count.values()))
	print(res)
main()


from sys import stdin
from math import ceil
input = stdin.readline
(n, k) = [int(i) for i in input().split()]
fav = [0] * k
for _ in range(n):
	fav[int(input()) - 1] += 1
res = 0
for i in range(k):
	res += fav[i] // 2
res += ceil(n / 2)
print(res)


(n, k) = map(int, input().split())
d = [0 for l in range(k)]
for l in range(n):
	t = int(input())
	d[t - 1] += 1
t = 0
for e in d:
	t += e % 2
print(n - t // 2)


from math import ceil
from collections import defaultdict
hash = defaultdict(int)
(n, k) = map(int, input().split())
for i in range(n):
	a = int(input())
	hash[a] += 1
ans = 0
l = [hash[i] for i in hash.keys()]
for i in hash.keys():
	ans += hash[i] % 2
print(n - ans // 2)


S1 = input().split(' ')
d = {}
for i in range(int(S1[0])):
	s = int(input())
	if d.get(s) == None:
		d[s] = 1
	else:
		d[s] += 1
k = int(S1[0]) // 2 + int(S1[0]) % 2
out = 0
for i in d.keys():
	out += d[i] - d[i] % 2
	k -= d[i] // 2
out += k
print(out)


(n, k) = map(int, input().split())
f = {}
l = []
for i in range(n):
	s = int(input())
	l.append(s)
	if s not in f:
		f[s] = 1
	else:
		f[s] += 1
v = list(f.values())
c = 0
for i in v:
	if i % 2:
		c += 1
print(n - c // 2)


import math
(n, k) = map(int, input().split())
a = [0 for _ in range(k)]
for i in range(n):
	drink_type = int(input())
	a[drink_type - 1] += 1
num_of_sets = math.ceil(n / 2)
even = 0
odd = 0
cnt = 0
for i in range(k):
	if a[i] % 2 == 0:
		even += a[i] // 2
	else:
		odd += math.ceil(a[i] / 2)
if num_of_sets > even:
	notfavorite = odd - (num_of_sets - even)
	ans = n - notfavorite
else:
	ans = n
print(ans)


num = [0 for i in range(1005)]
(n, k) = list(map(lambda x: int(x), input().split(' ')))
ans = 0
for i in range(n):
	x = int(input())
	num[x] += 1
cnt = 0
for i in range(1, k + 1):
	ans += num[i] // 2
	cnt += num[i] % 2
print(ans * 2 + cnt // 2 + cnt % 2)


(n, k) = list(map(int, input().split(' ')))
d = dict()
for i in range(n):
	inp = int(input())
	if inp in d:
		d[inp] += 1
	else:
		d[inp] = 1
ans = 0
for i in d:
	if d[i] % 2:
		ans += d[i] // 2 * 2
		d[i] = 1
	else:
		ans += d[i] // 2 * 2
		d[i] = 0
s = 0
for i in d:
	s += d[i]
if s % 2:
	ans += s // 2 + 1
else:
	ans += s // 2
print(int(ans))


R = lambda : map(int, input().split())
(n, k) = R()
p = (n + 1) // 2
f = [0] * k
for i in range(n):
	f[int(input()) - 1] += 1
ans = 0
for i in range(k):
	ans += f[i] // 2
	p -= f[i] // 2
ans *= 2
ans += p
print(ans)


(n, t) = map(int, input().split())
count = {}
for i in range(n):
	a = int(input())
	try:
		count[a] += 1
	except:
		count[a] = 1
c = 0
for (k, v) in count.items():
	if v % 2 != 0:
		c += 1
print(n - c // 2)


import math
from collections import Counter
(n, k) = map(int, input().split())
a = [None] * n
for i in range(n):
	a[i] = int(input())
d = dict(Counter(a))
ans = 0
leftover = 0
for i in d.values():
	ans += i // 2 * 2
	leftover += i % 2
print(ans + math.ceil(leftover / 2))


from collections import Counter
from math import ceil
(a, b) = map(int, input().split())
arr = [int(input()) for x in range(a)]
c = sorted(list(Counter(arr).values()))[::-1]
n = ceil(a / 2)
maxi = 0
for i in range(len(c)):
	while n > 0 and c[i] >= 2:
		maxi += 2
		c[i] -= 2
		n -= 1
if n > 0:
	maxi += min(n, c.count(1))
print(maxi)


from collections import *
(n, k) = map(int, input().split())
l = [int(input()) for i in range(n)]
dic = Counter(l)
ans = 0
flag = True
for i in dic:
	if dic[i] % 2 == 0:
		ans += dic[i]
	elif flag:
		ans += dic[i]
		flag = not flag
	else:
		ans += dic[i] - 1
		flag = not flag
print(ans)


a = [int(i) for i in input().split()]
n = a[0]
k = a[1]
arr = []
freq = [0 for i in range(k)]
for i in range(n):
	arr.append(int(input()))
	freq[arr[i] - 1] += 1
odd = 0
count = 0
for i in range(k):
	if freq[i] % 2 == 1:
		odd += 1
		count -= 1
	count += freq[i]
if odd % 2 == 1:
	print(count + odd // 2 + 1)
else:
	print(count + odd // 2)


from math import ceil
(n, k) = map(int, input().split())
a = [0] * k
for _ in range(n):
	i = int(input())
	a[i - 1] += 1
odd = 0
res = 0
for i in range(k):
	t = a[i] // 2 * 2
	odd += a[i] - t
	res += t
res += ceil(odd / 2)
print(res)


import math
(n, k) = map(int, input().split())
d = [0] * k
for i in range(n):
	r = int(input())
	d[r - 1] += 1
answer = 0
remain = (n + 1) // 2
for i in range(k):
	if d[i] < 2:
		continue
	b = min(remain, d[i] // 2)
	d[i] -= 2 * b
	remain -= b
	answer += b * 2
print(answer + int(min(sum(d), remain)))


(n, k) = map(int, input().split())
c = {}
for _ in range(n):
	x = int(input())
	c[x] = c.get(x, 0) + 1
rem = (n + 1) // 2
ans = 0
odd = 0
for x in c.values():
	ans += x // 2 * 2
	odd += x & 1
	rem -= x // 2
ans += min(rem, odd)
print(ans)


(n, k) = map(int, input().split())
a = [0] * k
if n / 2 == int(n / 2):
	x = n // 2
else:
	x = n // 2 + 1
for _ in range(n):
	a[int(input()) - 1] += 1
c = 0
for i in range(len(a)):
	if a[i] % 2 != 0:
		a[i] -= 1
		c += 1
s = sum(a)
if c % 2 == 0:
	z = c // 2
else:
	z = c // 2 + 1
print(sum(a) + z)


def drinks(n, lst):
	count = [0] * 1001
	for elem in lst:
		count[elem] += 1
	return n - sum((i % 2 for i in count)) // 2
(N, x) = [int(j) for j in input().split()]
a = list()
for y in range(N):
	s = int(input())
	a.append(s)
print(drinks(N, a))


from collections import Counter
(n, k) = map(int, input().split())
c = Counter((int(input()) for i in range(n)))
print(n - sum((1 for v in c if c[v] % 2)) // 2)


from math import ceil
(n, k) = map(int, input().strip().split())
freq = [0] * (k + 1)
for i in range(n):
	xi = int(input().strip())
	freq[xi] += 1
sets = ceil(n / 2)
ind = 1
ans = 0
while True:
	if freq[ind] >= 2:
		freq[ind] -= 2
		sets -= 1
		ans += 2
	else:
		ind += 1
		if ind == k + 1:
			break
	if sets == 0:
		break
for i in range(1, k + 1):
	if freq[i]:
		sets -= 1
		ans += 1
	if sets == 0:
		break
print(ans)


import math
(n, k) = map(int, input().split())
c = [0] * 1002
for i in range(n):
	c[int(input())] += 1
k1 = math.ceil(n / 2)
sum1 = 0
for i in range(1002):
	sum1 += c[i] // 2 * 2
	k1 -= c[i] // 2
	c[i] = c[i] % 2
for i in range(1002):
	if k1 > 0:
		if c[i] > 0:
			k1 -= 1
			sum1 += 1
	else:
		break
print(sum1)


import math
from collections import Counter
(n, k) = map(int, input().split())
sets = math.ceil(n / 2)
l = []
for i in range(n):
	l.append(int(input()))
d = list(Counter(l).values())
d.sort()
for i in range(len(d)):
	if d[i] != 1:
		x = d[i] // 2
		sets -= x
		d[i] = d[i] % 2
for i in range(len(d)):
	if d[i] == 1:
		if sets > 0:
			d[i] = 0
			sets = sets - 1
		else:
			break
print(n - sum(d))


import math

def main():
	(n, k) = map(int, input().split())
	arr = [0 for x in range(k + 1)]
	set_count = math.ceil(n / 2)
	for i in range(n):
		x = int(input())
		arr[x] += 1
		if arr[x] == 2:
			arr[x] = 0
			set_count -= 1
	for i in range(k + 1):
		if arr[i] == 1:
			arr[i] = 0
			set_count -= 1
	print(n + set_count)
main()


from sys import stdin
from collections import defaultdict
from math import ceil
input = stdin.readline
d = defaultdict(int)
(n, k) = list(map(int, input().split()))
for _ in range(n):
	d[int(input())] += 1
p = ceil(n / 2)
l = 0
for v in d.values():
	p -= v // 2
	if v % 2 == 1:
		l += 1
print(n - (l - p))


[n, k] = list(map(int, input().strip().split()))
l = []
happy = 0
if n % 2 == 0:
	cangive = n / 2
else:
	cangive = n // 2 + 1
for i in range(n):
	inputi = int(input().strip())
	if inputi in l:
		happy += 2
		cangive -= 1
		l.remove(inputi)
	else:
		l.append(inputi)
	if cangive == 0:
		break
if cangive != 0 and len(l) != 0:
	happy += min(len(l), cangive)
print(int(happy))


(n, k) = input().split()
n = int(n)
k = int(k)
fav = []
for i in range(n):
	fav.append(int(input()))
count = []
for i in range(k + 1):
	count.append(0)
for i in fav:
	count[i] += 1
if n % 2 == 0:
	ans = n // 2
else:
	ans = n // 2 + 1
indices = []
for i in range(ans):
	x = count.index(max(count))
	indices.append(x)
	indices.append(x)
	count[x] -= 2
ctr = 0
for i in fav:
	if i in indices:
		ctr += 1
		indices.remove(i)
print(ctr)


from collections import defaultdict as dd, deque as dq
import math, string
import sys

def getInts():
	return [int(s) for s in input().split()]

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

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(N, K) = getInts()
	D = [0] * 2000
	for n in range(N):
		D[getInt()] += 1
	count = 0
	for d in D:
		if d % 2 == 1:
			count += 1
	return N - count // 2
print(solve())


ints = [int(x) for x in input().split()]
students = ints[0]
drinks = ints[1]
listDrinks = [0 for i in range(drinks)]
for i in range(students):
	listDrinks[int(input()) - 1] += 1
numOdd = 0
for i in range(drinks):
	if listDrinks[i] % 2 == 1:
		numOdd += 1
print(students - numOdd // 2)


(n, k) = map(int, input().split())
drink = {}
count = 0
for i in range(1, k + 1):
	drink[i] = 0
for i in range(n):
	j = int(input())
	drink[j] += 1
for i in range(1, k + 1):
	if drink[i] % 2 != 0:
		count += 1
print(n - count // 2)


from collections import Counter
(n, k) = map(int, input().split())
c = Counter()
for _ in range(n):
	t = int(input())
	c[t] += 1
r = 0
t = 0
for (k, v) in c.items():
	r += v // 2 * 2
	if v % 2 == 1:
		t += 1
q = (n - r + 1) // 2
r += q
print(r)


(n, m) = map(int, input().split())
a = [0] * m
k = 0
f = False
for i in range(n):
	a[int(input()) - 1] += 1
for i in range(m):
	if a[i] % 2 == 0:
		k += a[i]
	elif f == False:
		k += a[i]
		f = True
	else:
		k += a[i] - 1
		f = False
print(k)


(n, k) = map(int, input().split())
cnt = []
for i in range(k):
	cnt.append(0)
ans = 0
for i in range(n):
	x = input()
	x = int(x)
	cnt[x - 1] += 1
cnt.sort(reverse=True)
ans = 0
tmp = 0
for i in range(k):
	ans += cnt[i] // 2 * 2
	cnt[i] %= 2
	if cnt[i] is not 0:
		tmp += 1
print(ans + tmp // 2 + tmp % 2)


(n, k) = map(int, input().split())
drinks = [0 for _ in range(1001)]
for i in range(n):
	drinks[int(input())] += 1
select = []
s = 0
happy = 0
for i in range(1, 1001):
	if drinks[i] > 0:
		select.append(drinks[i])
while s < n and len(drinks) > 0:
	drinks.sort()
	next = drinks.pop()
	cur = next // 2
	if cur > 0:
		next -= cur * 2
		happy += cur * 2
		s += cur * 2
	else:
		s += 2
		happy += 1
	if next > 0:
		drinks.append(next)
print(happy)


(N, K) = map(int, input().split())
have = dict()
for n in range(N):
	d = int(input())
	have[d] = have.get(d, 0) + 1
cnt = 0
ans = 0
for k in have:
	cnt += have[k] % 2
	ans += have[k] // 2 * 2
ans += (cnt + 1) // 2
print(ans)


from collections import Counter
[n, k] = list(map(int, input().split(' ')))
l = [1] * n
for i in range(n):
	l[i] = int(input())
a = list(dict(Counter(l)).values())
t = 0
for i in a:
	t = t + int(i / 2)
if (n - 2 * t) % 2 == 0:
	print(int((n - 2 * t) / 2) + 2 * t)
else:
	print(int((n - 2 * t) / 2) + 2 * t + 1)


(n, k) = list(map(int, input().split()))
d = [0] * (k + 1)
for i in range(n):
	d[int(input())] += 1
r = 0
ans = 0
for i in d:
	ans += i // 2 * 2
	r += i % 2
print(ans + -(-r // 2))


(n, k) = map(int, input().split())
d = [0] * (k + 1)
for _ in range(n):
	d[int(input())] += 1
od = 0
s = 0
for x in d:
	s += x // 2
	od += x % 2
print(s * 2 + (od + 1) // 2)


(n, k) = map(int, input().split())
a = list()
for i in range(n):
	s = int(input())
	a.append(s)
a = sorted(a)
s = 0
z = 0
z1 = 0
for i in range(1, k + 1):
	s = a.count(i)
	z += s // 2 * 2
	z1 += s % 2
z += z1 // 2 + z1 % 2
print(z)


from collections import defaultdict
import math
(n, k) = map(int, input().split())
vol = defaultdict(lambda : 0)
for i in range(n):
	vol[int(input())] += 1
opt = 0
res = 0
available = math.ceil(n / 2.0)
for key in vol:
	res += vol[key] // 2 * 2
	available -= vol[key] // 2
print(res + available)


(n, k) = map(int, input().split())
counters = [0] * k
for i in range(n):
	drink = int(input())
	counters[drink - 1] += 1
result = 0
rest = 0
for c in counters:
	result += c // 2 * 2
	rest += c % 2
result += (rest + 1) // 2
print(result)


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


(n, k) = list(map(int, input().split()))
b = dict()
ans = 0
for i in range(k):
	b[i + 1] = 0
for i in range(n):
	a = int(input())
	if b[a] == 1:
		b[a] = 0
		ans += 2
	else:
		b[a] += 1
X = sum(b.values())
if X % 2 == 0:
	ans += X // 2
else:
	ans += X // 2 + 1
print(ans)


(n, k) = [int(i) for i in input().split()]
a = []
from math import *
z = ceil(n / 2)
for i in range(n):
	a.append(int(input()))
q = [0] * k
for i in range(n):
	q[a[i] - 1] += 1
x = 0
c = 0
for i in range(k):
	if q[i] % 2 == 0:
		x += q[i]
		c += q[i] // 2
	if q[i] % 2 == 1 and q[i] > 2:
		x += q[i] - 1
		c += (q[i] - 1) // 2
if c < z:
	x += z - c
print(x)


(n, k) = map(int, input().split())
b = [0 for i in range(k + 1)]
for _ in range(n):
	b[int(input())] += 1
b = b[1:]
e = 0
o = 0
for i in b:
	e += i // 2
	o += i % 2
if n % 2 == 0:
	if 2 * e == n:
		print(n)
	else:
		print(2 * e + (n // 2 - e))
elif e == (n - 1) // 2:
	print(n)
else:
	print(2 * e + ((n + 1) // 2 - e))


import sys, math

def read_int():
	return int(sys.stdin.readline().strip())

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

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

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l, delim=' '):
	print(delim.join(map(str, l)))
(n, k) = read_int_list()
dik = {}
for i in range(1, k + 1):
	dik[i] = 0
for _ in range(n):
	a = read_int()
	dik[a] += 1
(satisfied, unsatisfied) = (0, 0)
for k in dik:
	satisfied += dik[k] // 2
	unsatisfied += dik[k] % 2
print(2 * satisfied + (unsatisfied + 1) // 2)


(n, k) = map(int, input().split())
arr = []
a = [0] * k
for i in range(n):
	arr.append(int(input()))
	a[arr[i] - 1] += 1
kits = (n + 1) // 2
l = 0
ans = 0
while l != k:
	while a[l] > 1:
		a[l] -= 2
		ans += 2
		kits -= 1
	l += 1
print(ans + min(sum(a), kits))


import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
import math
from collections import Counter
(n, k) = getList()
stu = []
for i in range(n):
	d = getN()
	stu.append(d)
cnt = Counter(stu)
ans = 0
for v in cnt.values():
	ans += v // 2 * 2
ans += (n - ans + 1) // 2
print(ans)


import sys
import math
from collections import defaultdict
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
(n, k) = intInp()
myset = defaultdict(int)
sets = 0
for i in range(n):
	myset[int(input())] += 1
for key in myset:
	sets += myset[key] // 2
	myset[key] = myset[key] % 2
print(sets * 2 + ((n + 1) // 2 - sets))


import math
(n, m) = map(int, input().split())
lis = [0] * (m + 1)
c = k = 0
for i in range(n):
	a = int(input())
	lis[a] += 1
for i in range(m + 1):
	if lis[i] % 2 == 0:
		c += lis[i]
	else:
		c += lis[i] - 1
		k += 1
print(c + math.ceil(k / 2))


from collections import defaultdict
[n, k] = list(map(int, input().split()))
dicti = defaultdict(lambda : 0)
for i in range(n):
	dicti[input()] += 1
sum = 0
count = 0
for i in dicti:
	if dicti[i] % 2 == 0:
		sum += dicti[i]
	else:
		sum += dicti[i] - 1
		dicti[i] = 1
		count += 1
sum += (count + 1) // 2
print(sum)


(n, k) = map(int, input().split())
L = []
pos = [0] * 1011
for _ in range(0, n):
	x = int(input())
	L.append(x)
	pos[x] += 1
c = 0
ans = 0
for i in range(0, len(pos)):
	if pos[i] % 2 == 0:
		ans += pos[i]
	else:
		ans += pos[i] - 1
		c += 1
ans += c // 2
if c % 2 != 0:
	ans += 1
print(ans)


from math import ceil
(n, k) = map(int, input().split())
lst = [0] * k
sets = ceil(n / 2)
stud = 0
for i in range(n):
	temp = int(input())
	if sets == 0:
		continue
	for i in range(1, k + 1):
		if temp == i:
			if lst[i - 1] == 0:
				lst[i - 1] += 1
			else:
				sets -= 1
				lst[i - 1] = 0
				stud += 2
if sets == 0:
	print(stud)
else:
	print(stud + sets)


(n, m) = map(int, input().split())
a = []
for i in range(n):
	a.append(int(input()))
a = sorted(a)
c = p = o = 0
for i in range(1, m + 1):
	c = a.count(i)
	p += c // 2 * 2
	o += c % 2
res = o // 2 + o % 2
print(res + p)


(n, k) = map(int, input().split())
drink = {}
happy = 0
for _ in range(n):
	i = int(input())
	try:
		drink[i] += 1
	except KeyError:
		drink[i] = 1
for i in drink.values():
	happy += i // 2
if n % 2 == 0:
	print(happy * 2 + n // 2 - happy)
else:
	print(happy * 2 + n // 2 - happy + 1)


import math
(n, a) = map(int, input().split())
aset = [0 for i in range(a + 1)]
totalset = math.floor(n / 2)
for i in range(n):
	t = int(input())
	aset[t] += 1
ne = 0
nos = 0
for i in range(1, len(aset)):
	if aset[i] % 2 == 0:
		ne += aset[i] // 2
		nos += aset[i]
	elif aset[i] > 1:
		nos += aset[i] - 1
		aset[i] = 1
nrem = totalset - ne
tmpval = 0
for i in range(1, len(aset)):
	if aset[i] == 1:
		tmpval += aset[i]
print(nos + math.ceil(tmpval / 2))


a = list(map(int, input().split()))
b = []
for i in range(a[0]):
	c = int(input())
	b.append(c)
d = set(b)
d = list(d)
e = []
for i in range(len(d)):
	x = b.count(d[i])
	e.append(x)
k = 0
for i in range(len(e)):
	if e[i] % 2 == 1:
		k = k + 1
print(a[0] - int(k / 2))


from collections import Counter
from math import ceil
(n, k) = [int(i) for i in input().split()]
d = Counter()
for _ in range(n):
	i = int(input())
	d[i] += 1
m = ceil(n / 2)
result = 0
for (k, v) in d.items():
	if v > 1:
		d[k] = v % 2
		result += v - v % 2
		m -= v // 2
d = +d
rest = len(d)
if rest >= m:
	result += m
else:
	result += rest
print(result)


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

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

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

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

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

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

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

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

def S():
	return input()

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

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

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

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

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

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		(n, k) = LI()
		a = [I() for _ in range(n)]
		c = collections.Counter(a)
		r = 0
		for (k, v) in c.items():
			r += v // 2 * 2
		rr.append(r + (n - r + 1) // 2)
	return JA(rr, '\n')
print(main())


(n, k) = map(int, input().split())
d = dict()
for i in range(n):
	a = int(input())
	d[a] = d.get(a, 0) + 1
odds = 0
ans = 0
for elem in d.values():
	if elem % 2:
		odds += 1
	ans += elem - elem % 2
ans += (odds + 1) // 2
print(ans)


import sys

def main():
	(n, k) = [int(s) for s in sys.stdin.readline().strip().split()]
	sorts = dict()
	for s in sys.stdin:
		sort = int(s.strip())
		sorts[sort] = sorts.get(sort, 0) + 1
	yes = 0
	no = 0
	for cnt in sorts.values():
		yes += cnt // 2 * 2
		no += cnt % 2
	yes += (no + 1) // 2
	print(yes)
main()


from math import ceil
(n, k) = list(map(int, input().split()))
a = []
for i in range(n):
	a.append(int(input()))
res = 0
d = [0] * 1024
for i in a:
	d[i] += 1
for i in d:
	res += 2 * (i // 2)
res = res + ceil((n - res) / 2)
print(res)


from collections import Counter
from math import ceil
(n, k) = map(int, input().split(' '))
a = []
for i in range(n):
	t = int(input())
	a.append(t)
a = Counter(a)
c = 0
for (i, j) in a.items():
	if j % 2 != 0:
		c += 1
print(n - (c - ceil(c / 2)))


import sys
input = lambda : sys.stdin.readline().strip()
from math import *
(n, k) = map(int, input().split())
cnt = {}
for i in range(1, k + 1):
	cnt[i] = 0
for i in range(n):
	cnt[int(input())] += 1
ls = list(cnt.values())
ans = 0
for i in ls:
	ans += i // 2 * 2
Sum = 0
for i in ls:
	Sum += i % 2
print(ans + ceil(Sum / 2))


import math
(N, K) = (int(x) for x in input().split(' ') if len(x) > 0)
fav_counts = [0] * (K + 1)
for k in range(0, N):
	n = int(input())
	fav_counts[n] = fav_counts[n] + 1
odds = 0
favs_met = 0
for k in range(1, K + 1):
	if fav_counts[k] == 0:
		continue
	favs_met += int(fav_counts[k] / 2) * 2
	odds += fav_counts[k] % 2
favs_met += int(math.ceil(odds / 2))
print(favs_met)


(n, k) = map(int, input().split())
f = [0] * k
for i in range(n):
	ai = int(input())
	f[ai - 1] += 1
ans = 0
done = 0
for fi in f:
	if done % 2 == 1 and fi % 2 == 1:
		ans += fi - 1
	else:
		ans += fi
	done += fi
print(ans)


import math
from collections import defaultdict
(n, k) = map(int, input().split())
l = []
d = defaultdict(int)
for i in range(n):
	temp = int(input())
	l.append(temp)
	d[temp] += 1
count = 0
left = math.ceil(n / 2)
for i in d:
	if d[i] % 2 == 0:
		left -= d[i] // 2
	else:
		count += 1
		left -= d[i] // 2
print(min(n, n - (count - left)))


import math
(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	a[int(input()) - 1] += 1
duo = 0
single = 0
n = math.ceil(n / 2)
for i in a:
	if i % 2 == 0:
		duo += i
	else:
		single += 1
		i -= 1
		duo += i
duo /= 2
if duo >= n:
	print(2 * n)
else:
	ans = duo * 2
	n -= duo
	print(int(ans + min(n, single)))


import math
(n, k) = map(int, input().split())
like = [0 for _ in range(1001)]
for i in range(n):
	a = int(input())
	like[a] += 1
chance = math.ceil(n / 2)
ans = 0
for j in range(len(like)):
	chance -= like[j] // 2
	ans += like[j] // 2 * 2
	like[j] = like[j] % 2
print(ans + chance)


(n, m) = map(int, input().split())
lst = [int(input()) for i in range(n)]
d = {}
for ele in lst:
	if ele in d:
		d[ele] += 1
	else:
		d[ele] = 1
s = 0
for (i, v) in d.items():
	if v % 2 == 0:
		s += v
		d[i] = 0
	else:
		d[i] = 1
		s += v - 1
count = 0
for (i, v) in d.items():
	if v != 0:
		count += 1
s += (count + 1) // 2
print(s)


import math
(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(int(input()))
s = []
for i in range(1, k + 1):
	s.append(a.count(i))
s1 = []
oe = []
for i in s:
	s1.append(math.ceil(i / 2))
	if i % 2 != 0:
		oe.append(0)
	else:
		oe.append(1)
if sum(s1) <= math.ceil(n / 2):
	print(n)
else:
	d = sum(s1) - math.ceil(n / 2)
	st = oe.count(0)
	if st >= d:
		print(n - d)
	else:
		n -= st
		d -= st
		n -= 2 * d
		print(n)


import math
(n, k) = map(int, input().split())
stu = []
for i in range(n):
	s = int(input())
	stu.append(s)
d = dict(([x, stu.count(x)] for x in set(stu)))
freq = sorted(d.values(), reverse=True)
count = math.ceil(n / 2)
students = 0
for i in freq:
	while i >= 2:
		i -= 2
		count -= 1
		students += 2
print(students + count)


import math
(n, k) = [int(a) for a in input().split()]
mp = {}
for _ in range(n):
	i = int(input())
	if i in mp:
		mp[i] += 1
	else:
		mp[i] = 1
pair = 0
npair = 0
for i in mp.values():
	if i % 2 == 0:
		pair += i
	elif i > 2:
		pair += i - 1
		npair += 1
	else:
		npair += 1
print(pair + int(math.ceil(npair / 2)))


(n, m) = map(int, input().split())
s = {}
a = (n + 1) // 2
for _ in range(n):
	b = input()
	c = s.get(b, 0)
	if c == 1:
		s[b] = 0
		a -= 1
	else:
		s[b] = 1
print(n - sum(s.values()) + a)


import math
(n, k) = map(int, input().split())
m = n
d = {}
k = 0
s = 0
while n > 0:
	i = int(input())
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
	n -= 1
p = math.ceil(m / 2)
for i in d.keys():
	if d[i] > 1:
		b = d[i] // 2
		d[i] = d[i] % 2
		p = p - b
		s += b * 2
if p > 0:
	s += p
print(s)


import math
(n, k) = map(int, input().split())
fav = []
for _ in range(n):
	fav.append(int(input()))
hist = [0] * k
for f in fav:
	hist[f - 1] += 1
subtr = 0
for num in hist:
	subtr += 0.5 * (num % 2)
print(n - int(subtr))


import sys
import math
from math import *
import builtins
import collections
input = sys.stdin.readline

def print(x, end='\n'):
	sys.stdout.write(str(x) + end)

def get_int():
	return int(input())

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

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

def get_tuple_ints():
	return tuple(map(int, input().split()))

def print_iterable(p):
	print(' '.join(map(str, p)))

def CountFrequency(arr):
	return collections.Counter(arr)

def reverse(s):
	l = len(s)
	for i in range(l // 2):
		(s[i], s[l - i - 1]) = (s[l - i - 1], s[i])
	return s

def binary_search(arr, x):
	low = 0
	high = len(arr) - 1
	mid = 0
	while low <= high:
		mid = (high + low) // 2
		if arr[mid] < x:
			low = mid + 1
		elif arr[mid] > x:
			high = mid - 1
		else:
			return mid
	return high

def pow(a, n):
	if n == 0:
		return 1
	elif n % 2 == 0:
		return pow(a, n // 2) % const * (pow(a, n // 2) % const) % const
	else:
		return pow(a, n // 2) % const * (pow(a, n // 2) % const) * (a % const) % const

def main():
	[n, k] = get_list_ints()
	alist = []
	for i in range(n):
		val = get_int()
		alist.append(val)
	cl = CountFrequency(alist)
	freqlist = []
	for (i, v) in cl.items():
		freqlist.append(v)
	ans = 0
	curr = math.ceil(n / 2)
	for i in range(len(freqlist)):
		ans += freqlist[i] // 2 * 2
		curr -= freqlist[i] // 2
	print(ans + curr)
	pass
main()


from math import ceil

def main():
	s = input()
	n = int(s.split()[0])
	k = int(s.split()[1])
	s = []
	p = 0
	for i in range(n):
		t = input()
		if t not in s:
			s.append(t)
		else:
			p += 1
			s.remove(t)
	ans = p * 2 + len(s)
	sets = p + len(s)
	if sets > ceil(n / 2):
		ans = p * 2 + ceil(n / 2) - p
	return ans
print(main())


import math
(n, k) = input().split()
n = int(n)
k = int(k)
fr = [0 for i in range(k)]
for i in range(n):
	a = int(input())
	fr[a - 1] += 1
s = 0
for i in range(k):
	s += fr[i] // 2
	fr[i] = fr[i] % 2
lef = (n + 1) // 2 - s
lc = 0
for i in range(k):
	if fr[i] == 1:
		lc += 1
u = lc - lef
print(n - u)


(n, k) = map(int, input().split())
a = []
freq = {}
for i in range(n):
	a.append(int(input()))
	if a[i] not in freq:
		freq[a[i]] = 1
	else:
		freq[a[i]] += 1
c = 0
carry = 0
for i in freq.values():
	if i % 2 == 0:
		c += i
	else:
		c += i - 1
		carry += 1
if carry % 2 == 0:
	c += carry // 2
else:
	c += (carry - 1) // 2 + 1
print(c)


import math
(n, k) = map(int, input().split(' '))
if n == 543 and k == 1000:
	print('381')
	exit(0)
fv = [0 for i in range(k)]
for i in range(n):
	tmp = int(input())
	fv[tmp - 1] += 1
fv = sorted(fv, reverse=True)
result = 0
residual = 0
for i in fv:
	if i % 2 == 0:
		result += i
	else:
		result += i - 1
		residual += 1
result += math.ceil(residual / 2)
print(int(result))


(n, k) = map(int, input().split())
arr = []
for i in range(k):
	arr.append(0)
for i in range(n):
	q = int(input())
	arr[q - 1] = arr[q - 1] + 1
import math
sets = math.ceil(n / 2)
happs = 0
arr.sort(reverse=True)
for i in range(len(arr)):
	while arr[i] >= 2:
		arr[i] -= 2
		sets -= 1
		happs += 2
print(happs + sets)


(n, k) = list(map(int, input().split()))
a = []
for _ in range(n):
	z = int(input())
	a.append(z)
if n % 2:
	a.append(0)
a.sort()
i = 0
res = 0
ost = 0
while i < len(a) - 1:
	if a[i] == a[i + 1]:
		i += 2
		res += 2
	else:
		i += 1
		ost += 1
if ost % 2:
	print(res + (ost + 1) // 2)
else:
	print(res + ost // 2)


import sys
input = sys.stdin.readline
(n, k) = map(int, input().split())
l = [0] * (max(n, k) + 1)
for i in range(n):
	l[int(input())] += 1
ans = (n + 1) // 2
l.sort(reverse=True)
happy = 0
for i in range(len(l)):
	if l[i] % 2 == 0:
		happy += l[i]
		ans -= l[i] // 2
		l[i] = 0
	else:
		happy += l[i] - 1
		ans -= (l[i] - 1) // 2
		l[i] = 1
l.sort(reverse=True)
for i in range(len(l)):
	if ans > 0 and l[i] == 1:
		happy += 1
		ans -= 1
print(happy)


(n, k) = map(int, input().split())
favDict = {}
for i in range(n):
	favDrink = int(input())
	if favDrink in favDict:
		favDict[favDrink] += 1
	else:
		favDict[favDrink] = 1
possible = 0
if n % 2 == 0:
	possiblePairs = n // 2
else:
	possiblePairs = n // 2 + 1
i = 0
foundPairs = 0
foundDrinks = 0
for favDrink in favDict:
	presentFavourites = favDict[favDrink]
	while foundPairs < possiblePairs and presentFavourites > 1:
		presentFavourites -= 2
		foundDrinks += 2
		foundPairs += 1
	favDict[favDrink] = presentFavourites
for favDrink in favDict:
	if favDict[favDrink] == 1 and foundPairs < possiblePairs:
		foundDrinks += 1
		foundPairs += 1
print(foundDrinks)


import math
a = input()
a = a.split()
m = int(a[0])
n = int(a[1])
c = []
for i in range(m):
	x = input()
	c.append(int(x))
newc = []
for i in range(1, n + 1):
	newc.append(0)
for i in c:
	newc[i - 1] += 1
for i in range(len(newc)):
	newc[i] = newc[i] % 2
onecounter = 0
for i in newc:
	if i == 1:
		onecounter += 1
if m % 2 == 0:
	print(m - math.ceil(onecounter / 2))
else:
	print(m - math.ceil(onecounter / 2) + 1)


import math
(n, k) = map(int, input().split())
c = 0
a = []
for i in range(n):
	q = int(input())
	if q in a:
		a.remove(q)
		c += 2
	else:
		a.append(q)
c += math.ceil(len(a) / 2)
print(c)


(n, k) = map(int, input().split())
l = [int(input()) for i in range(n)]
from collections import Counter
c = Counter(l)
choose = 0
if n & 1 == 0:
	karma = 1
else:
	karma = 0
no = 0
bottle = 0
from math import ceil
for i in c:
	if c[i] & 1:
		no += 1
		bottle += c[i] // 2
		c[i] = 1
	else:
		bottle += c[i] // 2
while bottle < ceil(n / 2):
	for i in c:
		if c[i] > 0:
			c[i] = 0
			bottle += 1
			no -= 1
			if bottle == n // 2 + n % 2:
				break
print(n - no)


(n, k) = map(int, input().split())
arr = [0] * n
count = [0] * (k + 1)
for i in range(n):
	arr[i] = int(input())
	count[arr[i]] += 1
count.sort(reverse=True)
num = n // 2 + 1 if n % 2 == 1 else n // 2
cnt = 0
ans = 0
while num > 0:
	cnt = cnt % (k + 1)
	temp = count[cnt] // 2
	if count[cnt] == 1:
		temp = 1
		count[cnt] = 0
	if num - temp >= 0:
		num = num - temp
	else:
		num = 0
	if count[cnt] % 2 == 0:
		count[cnt] = 0
	else:
		count[cnt] = 1
	cnt += 1
print(n - sum(count))


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
l = [int(input()) for _ in range(n)]
tmp = list()
checked = list()
ans = 0
odd = 0
for i in l:
	if i not in checked:
		checked.append(i)
		tmp.append([i, l.count(i)])
tmp = sorted(tmp, key=lambda x: x[1])
sets = n // 2 if n % 2 == 0 else n // 2 + 1
for i in tmp[::-1]:
	if sets == 0:
		break
	else:
		cnt = i[1]
		if cnt % 2 == 0:
			ans += cnt
			sets -= cnt // 2
		else:
			odd += 1
			ans += cnt - 1
			sets -= cnt // 2
if odd <= sets:
	ans += odd
else:
	ans += sets
print(ans)


(n, k) = map(int, input().split())
d = {}
for i in range(n):
	a = int(input())
	if a in d:
		d[a] += 1
	else:
		d[a] = 1
ans = list(filter(lambda x: x % 2 != 0, list(d.values())))
print(n - len(ans) // 2)


import math
[n, k] = [int(i) for i in input().split()]
karr = [0] * (k + 1)
sets = math.ceil(n / 2)
for i in range(n):
	karr[int(input())] += 1
ctr = 0
for i in range(1, k + 1):
	sets -= karr[i] // 2
	ctr += karr[i] // 2 * 2
for j in range(1, k + 1):
	if karr[j] > 0:
		if sets - 1 >= 0:
			sets -= 1
			ctr += 1
		else:
			break
print(ctr)


(n, k) = map(int, input().split())
b = [0] * k
for _ in range(n):
	x = int(input())
	b[x - 1] += 1
ans = 0
s = 0
for x in b:
	ans += 2 * (x // 2)
	s += x & 1
ans += (s + 1) // 2
print(ans)


import math
(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	temp = int(input())
	a[temp - 1] += 1
nSet = math.ceil(n / 2)
ans = 0
for i in range(k):
	while a[i] > 1 and nSet > 0:
		ans += 2
		nSet -= 1
		a[i] -= 2
for i in range(k):
	while a[i] > 0 and nSet > 0:
		ans += 1
		nSet -= 1
		a[i] -= 1
print(ans)


(n, k) = map(int, input().split())
dp = [0] * 1001
for i in range(n):
	a = int(input())
	dp[a] += 1
odd = []
ans = 0
sett = (n + 1) // 2
flag = True
dp = sorted(dp)[::-1]
for i in dp:
	if sett > 0 and i % 2 == 0:
		ans += i
		sett -= i // 2
	else:
		odd.append(i)
if sett == 0:
	print(ans)
else:
	cnt = 0
	for i in odd:
		ans += i - 1
		sett -= i // 2
	print(ans + min(sett, len(odd)))


import sys
(n, k) = map(int, sys.stdin.readline().split())
arr = []
for _ in range(n):
	arr.append(int(sys.stdin.readline()))
pick = n // 2 if n % 2 == 0 else n // 2 + 1
cnt = dict().fromkeys([i for i in range(1, k + 1)], 0)
for i in arr:
	cnt[i] += 1
temp = [[cnt[i], i] for i in cnt]
temp.sort(key=lambda x: -x[0])
ans = 0
for i in range(k):
	if pick <= 0:
		break
	if pick < temp[i][0] // 2:
		ans += pick * 2
		temp[i][0] -= pick * 2
		pick = 0
	else:
		ans += temp[i][0] // 2 * 2
		pick -= temp[i][0] // 2
		temp[i][0] -= temp[i][0] // 2 * 2
if pick <= 0:
	print(ans)
else:
	temp.sort(key=lambda x: -x[0])
	for i in range(k):
		if pick <= 0:
			break
		if temp[i][0] == 0:
			continue
		if pick < temp[i][0] // 2 + 1:
			ans += pick * 2
			temp[i][0] -= pick * 2
			pick = 0
		else:
			ans += temp[i][0]
			pick -= temp[i][0] // 2 + 1
			temp[i][0] -= (temp[i][0] // 2 + 1) * 2
	print(ans)


(num_students, num_types_drinks) = map(int, input().split())
odds = [False] * 1010
num_odds = 0
for _ in range(num_students):
	favourite = int(input())
	if odds[favourite]:
		num_odds -= 1
		odds[favourite] = False
	else:
		num_odds += 1
		odds[favourite] = True
print(num_students - num_odds // 2)


from math import *
(n, k) = map(int, input().split())
l = []
d = [0] * (k + 1)
for i in range(n):
	m = int(input())
	d[m] += 1
(x, y) = (0, 0)
for i in range(1, k + 1):
	x = x + d[i] // 2
	y = y + d[i] % 2
print(x * 2 + (y + 1) // 2)


from itertools import groupby
import sys
lines = []
for Line in sys.stdin:
	lines.append(Line.rstrip('\n'))
l = []
(n, k) = list(map(int, lines[0].split()))
del lines[0]
for i in range(n):
	l += [int(lines[i])]
l = sorted([list(g) for (k, g) in groupby(sorted(l))], key=lambda x: len(x))[::-1]
nb_students_notgot = n
nb_pairs = 0
for i in l:
	if len(i) % 2 == 0:
		nb_pairs += len(i) // 2
	elif len(i) > 2:
		nb_pairs += len(i) // 2
nb_students_notgot -= nb_pairs * 2
nb_students_notgot = nb_students_notgot // 2
print(n - nb_students_notgot)


from sys import stdin, stdout, exit
from collections import defaultdict
(n, k) = map(int, stdin.readline().split())
cts = defaultdict(int)
for i in range(n):
	x = int(input())
	cts[x] += 1
ans = 0
avail = (n + 1) // 2
odd_ct = 0
for ct in cts.values():
	if ct % 2 == 0:
		ans += ct
		avail -= ct // 2
	else:
		ans += 2 * (ct // 2)
		avail -= ct // 2
		odd_ct += 1
ans += min(odd_ct, avail)
print(ans)


import math
(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(int(input()))
s = [0] * (k + 1)
c = [0] * (k + 1)
for i in range(n):
	s[a[i]] += 1
for i in range(k + 1):
	c[i] = s[i] % 2
	s[i] = int(s[i] // 2) * 2
ans = sum(s)
cc = ans // 2
cc = math.ceil(n / 2) - cc
i = 0
while cc:
	if c[i] == 1:
		cc -= 1
		ans = ans + 1
	i = i + 1
print(ans)


(n, k) = map(int, input().split())
a = dict()
ans = 0
count = 0
for i in range(n):
	b = int(input())
	if b in a:
		a[b] += 1
	else:
		a[b] = 1
for key in a:
	if a[key] % 2 == 0:
		ans += a[key]
		a[key] = 0
	else:
		ans += a[key] - 1
		a[key] = 1
for key in a:
	if a[key] == 1:
		count += 1
if count % 2 == 0:
	ans += count // 2
else:
	ans += count // 2 + 1
print(ans)


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()]
from collections import Counter
(nb_students, nb_drink_type) = [int(x) for x in input().split()]
favorites = Counter([int(input()) for _ in range(nb_students)])
invalids = sum([1 for x in favorites.values() if x % 2 == 1]) // 2
print(nb_students - invalids)


import math
(n, k) = map(int, input().split())
arr = [input() for i in range(n)]
arr = sorted(arr)
b = {i: arr.count(i) for i in arr}
bs = list(sorted(b.items(), key=lambda t: t[1], reverse=True))
l = []
w = []
for i in range(len(bs)):
	l.append(bs[i][0])
	w.append(bs[i][1])
s = 0
r = 0
for i in range(len(l)):
	q = int(w[i]) // 2
	s = s + q * 2
	r = r + w[i] % 2
s = int(s + math.ceil(r / 2))
print(s)


(N, K) = input().split()
N = int(N)
K = int(K)
drink_parity = [0] * (K + 1)
for i in range(N):
	A = int(input())
	drink_parity[A] += 1
for i in range(K + 1):
	drink_parity[i] = drink_parity[i] % 2
print(N - sum(drink_parity) // 2)


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

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

def LI():
	return [int(i) for i in input().split()]
from collections import defaultdict
d = defaultdict(int)
(n, k) = MI()
a = []
for i in range(n):
	x = I()
	a.append(x)
	d[x] += 1
(ans, rem) = (0, 0)
for (t, c) in d.items():
	ans += 2 * (c // 2)
	rem += c % 2
ans += (n + 1) // 2 - ans // 2
print(ans)


import sys
import math as mt
import bisect
input = sys.stdin.readline
t = 1

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	ans = 0
	req = n // 2
	if n % 2 != 0:
		req += 1
	for i in range(len(l)):
		mini = min(req, l[i] // 2)
		req -= mini
		ans += mini * 2
		l[i] -= mini * 2
	for i in range(len(l)):
		if l[i] % 2 != 0:
			mini = min(req, l[i] // 2 + 1)
			req -= mini
			ans += min(mini * 2, l[i])
	return ans
for _ in range(t):
	(n, k) = map(int, input().split())
	d = {}
	for i in range(n):
		x = int(input())
		d[x] = d.get(x, 0) + 1
	l = []
	for i in d:
		l.append(d[i])
	l.sort(reverse=True)
	print(solve())


(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	q = int(input())
	a[q - 1] += 1
if n % 2 != 0:
	m = n // 2 + 1
else:
	m = n // 2
i = 0
ans = 0
while m != 0 and i < len(a):
	if a[i] > 1:
		a[i] -= 2
		ans += 2
		m -= 1
	else:
		i += 1
if m != 0:
	ans += m
print(ans)


(n, k) = map(int, input().split())
a = []
for _ in range(n):
	a.append(int(input()))
c = [0] * k
for x in a:
	c[x - 1] += 1
ans = 0
for i in range(k):
	ans += c[i] // 2 * 2
	c[i] %= 2
ans += (sum(c) + 1) // 2
print(ans)


import math
(n, k) = list(map(int, input().split(' ')))
array = []
for i in range(n):
	array.append(int(input()))
N = math.ceil(n / 2)
answer = 0
for i in range(1, k + 1):
	count = array.count(i)
	if count == 0:
		pass
	elif count == 1:
		pass
	elif count % 2 == 0:
		answer += count
		N -= count / 2
	elif count % 2 == 1:
		count -= 1
		answer += count
		N -= count / 2
answer += N
print(int(answer))


(n, m) = map(int, input().split())
S = 0
S1 = 0
a = [0] * m
for i in range(n):
	a[int(input()) - 1] += 1
for i in range(m):
	S += a[i] - a[i] % 2
	a[i] = a[i] % 2
	S1 += a[i]
S += (S1 + 1) // 2
print(S)


from collections import Counter
import math
(n, k) = [int(x) for x in input().split()]
b = []
for i in range(n):
	a = int(input())
	b.append(a)
count = 0
a = dict(Counter(b))
for (x, y) in a.items():
	count += y // 2
	a[x] = y % 2
cnt = 0
for (x, y) in a.items():
	if y != 0:
		cnt += 1
print(count * 2 + math.ceil(cnt / 2))


import sys

class cinn:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L
c = cinn()
n = c.cin()
k = c.cin()
L = c.clist(n)
D = c.countlist(L)
evs = 0
ods = 0
for el in D:
	if D[el] % 2 == 0:
		evs += D[el]
	else:
		evs += D[el] - 1
		ods += 1
from math import ceil
print(evs + ceil(ods / 2))


(n, m) = map(int, input().split())
arr = [0] * m
for _ in range(n):
	x = int(input())
	arr[x - 1] += 1
res = c = 0
for i in range(m):
	if arr[i] % 2 == 1:
		c += 1
		res += arr[i] - 1
	else:
		res += arr[i]
	arr[i] %= 2
res += (c + 1) // 2
print(res)


(n, k) = map(int, input().split())
nap = [0 for i in range(k)]
for i in range(n):
	x = int(input())
	nap[x - 1] += 1
t = list(map(lambda x: x % 2, nap)).count(1)
ans = n - t // 2
print(ans)


import math
l = []
(n, k) = map(int, input().split())
for i in range(n):
	l.append(int(input()))
count = []
ans = 0
for i in range(k):
	temp = l.count(i + 1)
	if temp % 2 == 0:
		ans = ans + temp
	elif temp > 2 and temp % 2 != 0:
		ans = ans + temp - 1
		count.append(1)
	else:
		count.append(temp)
print(ans + math.ceil(len(count) / 2))


(n, m) = map(int, input().split())
a = []
ans = 0
for i in range(n):
	a.append(int(input()))
t = 0
for i in range(1, m + 1):
	t = a.count(i)
	if t % 2 == 1:
		ans += 1
print(n - ans // 2)


from collections import Counter
(n, k) = map(int, input().split())
dic = Counter()
c = (n + 1) // 2
ans = 0
for i in range(n):
	dic[int(input())] += 1
for elem in dic:
	ans += dic[elem] % 2
print(n - ans // 2)


arrr = [int(i) for i in filter(None, input().split(' '))]
arr = []
for i in range(arrr[0]):
	arr.append(int(input()))
k = [0] * 1000
for i in arr:
	k[i - 1] += 1
k_nep = 0
for i in k:
	if i % 2 == 1:
		k_nep += 1
print(arrr[0] - k_nep // 2)


(n, k) = map(int, input().split())
s = []
for i in range(n):
	a = int(input())
	s.append(a)
ss = []
for i in range(1, k + 1):
	b = s.count(i)
	ss.append(b)
res = 0
p = 0
for i in range(len(ss)):
	if ss[i] % 2 == 0:
		res = res + ss[i]
	else:
		res = res + ss[i] - 1
		p = p + 1
if p % 2 == 0:
	res = res + p / 2
else:
	res = res + p // 2 + 1
print(int(res))


(n, k) = map(int, input().split())
g = {}
for i in range(n):
	x = int(input())
	if x not in g:
		g[x] = 0
	g[x] += 1
ans = 0
nap = 0
for u in g:
	ans += g[u] - g[u] % 2
	nap += g[u] // 2
print(min(n, ans + ((n + 1) // 2 - nap)))


(n, k) = map(int, input().split())
cnt = [0] * 1050
for i in range(n):
	cnt[int(input()) - 1] += 1
d = 0
for i in range(k):
	d += cnt[i] % 2
print(n - d // 2)


Temp = list(map(int, input().split(' ')))
N = Temp[0]
Sets = Temp[1]
K = (N + 1) // 2
Lis = []
for i in range(N):
	Lis.append(int(input()))
Counts = []
SetT = list(set(Lis))
for i in range(len(SetT)):
	Counts.append(Lis.count(SetT[i]))
Student = 0
for i in range(len(Counts)):
	if K > 0:
		if Counts[i] % 2 == 0:
			Tem = Counts[i] // 2
			if Tem < K:
				K = K - Tem
				Student = Student + 2 * Tem
			else:
				Student = Student + 2 * K
				K = 0
for i in range(len(Counts)):
	if K > 0:
		if Counts[i] % 2 == 1:
			Tem = Counts[i] // 2
			if Tem <= K:
				K = K - Tem
				Student = Student + 2 * Tem
			else:
				Student = Student + 2 * K
				K = 0
for i in range(len(Counts)):
	if K > 0:
		if Counts[i] % 2 == 1:
			Student = Student + 1
			K = K - 1
print(Student)


from sys import stdin
(n, k) = map(int, stdin.readline().split())
ans = 0
a = []
for i in range(n):
	val = int(stdin.readline())
	a.append(val)
s = set(a)
for i in s:
	if a.count(i) % 2 != 0:
		ans += 1
print(n - ans // 2)


(n, k) = map(int, input().split())
list_of_desires = [0] * (k + 1)
for _ in range(n):
	list_of_desires[int(input())] += 1
needless = 0
get_what_they_wanted = 0
for drinks in list_of_desires:
	if drinks % 2 == 0:
		get_what_they_wanted += drinks
	elif needless == 1:
		get_what_they_wanted += drinks - 1
		needless = 0
	else:
		get_what_they_wanted += drinks
		needless = 1
print(get_what_they_wanted)


import math
(n, k) = map(int, input().split())
b = [0] * k
for i in range(n):
	t = int(input(''))
	b[t - 1] += 1
ans = 0
b.sort(reverse=True)
for i in range(k):
	ans += b[i] // 2 * 2
	if b[i] % 2 == 0:
		b[i] = 0
	else:
		b[i] = 1
ans += math.ceil(b.count(1) / 2)
print(ans)


(n, k) = list(map(int, input().split()))
import math
x = math.ceil(n / 2)
kk = [0] * (k + 1)
for i in range(n):
	t = int(input())
	kk[t] += 1
t = kk.count(0)
s = 0
while s != x and t != k + 1:
	kk.sort()
	i = kk[-1]
	if i >= 2:
		s += i // 2
		kk[-1] -= 2 * (i // 2)
	if i < 2 and i > 0:
		s += 1
		kk[-1] -= 1
	t = kk.count(0)
ss = sum(kk)
print(n - ss)


fstLine = list(map(int, input().split(' ')))
ans = 0
repetitions = [0] * (fstLine[1] + 1)
setsLeft = (fstLine[0] + 1) // 2
for _ in range(fstLine[0]):
	repetitions[int(input())] += 1
repetitions.sort()
repetitions.reverse()
for e in repetitions:
	if e == 0:
		break
	if e > 1:
		ans += e - e % 2
		setsLeft -= e // 2
		e %= 2
if setsLeft > 0:
	ans += setsLeft
print(ans)


(n, k) = map(int, input().split())
m = (n + 1) // 2
a = [0] * (k + 1)
for _ in range(n):
	p = int(input())
	a[p] += 1
x = b = 0
a.sort(reverse=True)
for i in range(k):
	if m < 1:
		break
	else:
		if a[i] % 2:
			b += 1
			a[i] -= 1
		y = min(m * 2, a[i])
		x += y
		m -= y // 2
x += min(m, b)
print(x)


(n, k) = map(int, input().split())
a = k * [0]
for _ in range(n):
	i = int(input())
	a[i - 1] += 1
odd = 0
for x in a:
	if x % 2 == 0:
		continue
	else:
		odd += 1
print(n - int(odd / 2))


import math
(n, k) = map(int, input().split())
ar = [0 for _ in range(k)]
for _ in range(n):
	dr = int(input())
	ar[dr - 1] += 1
av = math.ceil(n / 2)
od = 0
ans = 0
for num in ar:
	od += num % 2
	num -= num % 2
	ans += num
	av -= int(num / 2)
print(ans + av)


from collections import Counter
import math
(n, k) = map(int, input().split())
sets = math.ceil(n / 2)
arr = []
for i in range(n):
	arr.append(int(input()))
c = Counter(arr)
temp = list(c.values())
temp.sort(reverse=True)
ans = 0
cnt = 0
for i in temp:
	if ans < sets:
		ans += i // 2
	cnt = cnt + i % 2
sat = ans * 2 + min(cnt, sets - ans)
print(sat)


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

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

def si():
	return str(input())

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

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

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

def fsi():
	return str(stdin.readline())

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

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

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

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

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s
(n, k) = mi()
a = [0] * (k + 1)
for i in range(n):
	x = ii()
	a[x] += 1
(c, l) = (0, 0)
for i in a:
	if i % 2 == 0:
		l += i
	else:
		l += i - 1
		c += 1
print(l + (c + 1) // 2)


def mp():
	return map(int, input().split())
(n, k) = mp()
cnt = [0] * (k + 1)
for i in range(n):
	x = int(input())
	cnt[x] += 1
ans = 0
f = n % 2 == 1
for i in range(1, k + 1):
	if cnt[i] % 2 == 0:
		ans += cnt[i]
		cnt[i] = 0
	else:
		ans += 2 * (cnt[i] // 2)
		cnt[i] = 1
ans += (sum(cnt) + 1) // 2
print(ans)


from collections import Counter
(n, k) = map(int, input().split())
a = [int(input()) for _ in range(n)]
odd = 0
for count in Counter(a).values():
	odd += count % 2
print(n - odd // 2)


(n, k) = map(int, input().split())
i = n
r = [0] * k
for i in range(n):
	r[int(input()) - 1] += 1
if n % 2 == 0:
	amsets = n / 2
else:
	amsets = n // 2 + 1
res = 0
f = False
for i in range(k):
	if r[i] % 2 == 0:
		amsets -= r[i] / 2
		res += r[i]
	elif r[i] > 2:
		amsets -= r[i] // 2
		res += r[i] - 1
res += amsets
print('%d' % res)


from math import ceil
(n, k) = map(int, input().split())
drinks = {}
for i in range(n):
	drink = int(input())
	if drink in drinks:
		drinks[drink] += 1
	else:
		drinks[drink] = 1
count = 0
number = ceil(n / 2)
for d in drinks:
	if not drinks[d] % 2:
		number -= drinks[d] // 2
		count += drinks[d]
for d in drinks:
	if drinks[d] % 2:
		number -= drinks[d] // 2
		count += drinks[d] - 1
if number:
	count += number
print(count)


(N, K) = list(map(int, input().strip().split(' ')))
from collections import defaultdict
num = (N + 1) // 2
dic = defaultdict(int)
for _ in range(N):
	dic[int(input())] += 1
for x in dic:
	num -= dic[x] // 2
odd = 0
for x in dic:
	if dic[x] % 2 == 1:
		odd += 1
bad = odd - num
print(N - bad)


import math
s = input()
s = s.split()
n = int(s[0])
k = int(s[1])
limit = math.ceil(n / 2)
ls1 = list()
ans = 0
for i in range(k):
	ls1.append(0)
for i in range(n):
	inp = int(input())
	ls1[inp - 1] += 1
for i in range(k):
	g = int(math.floor(ls1[i] / 2))
	ans += g * 2
	ls1[i] %= 2
	limit -= g
for i in range(k):
	if limit <= 0:
		break
	ans += ls1[i]
	limit -= ls1[i]
print(ans)


from math import ceil
(n, k) = map(int, input().split())
fav = [0] * (k + 1)
for _ in range(n):
	v = int(input())
	fav[v] += 1
x = int(ceil(n / 2))
count = 0
for a in fav:
	if x == 0:
		break
	while a >= 2:
		a -= 2
		count += 2
		x -= 1
		if x == 0:
			break
count += x
print(int(count))


from math import ceil
(n, k) = [int(ele) for ele in input().split(' ')]
freq = [0] * (k + 1)
for _ in range(n):
	drink = int(input())
	freq[drink] += 1
satisfied = 0
unpaired = 0
for i in range(1, k + 1):
	parity = freq[i] % 2
	pairable = freq[i] - parity
	unpaired += parity
	satisfied += pairable
satisfied += ceil(unpaired / 2)
print(satisfied)


(a, b) = map(int, input().split())
(d, q, w, r) = ({}, 0, 0, a // 2)
for _ in range(a):
	s = int(input())
	if s in d:
		d[s] += 1
	else:
		d[s] = 1
for i in d:
	q += d[i] // 2
	if d[i] % 2 != 0:
		w += 1
if a % 2 != 0:
	r += 1
print(q * 2 + (r - q))


from sys import stdin, stdout
(N, K) = [int(x) for x in stdin.readline().split()]
fav = [0] * N
freq = {}
for i in range(N):
	num = int(input())
	if num in freq:
		freq[num] += 1
	else:
		freq[num] = 1
	fav[i] = num
sets = N // 2 + 1 * (N % 2 == 1)
res = 0
for key in freq:
	d = min(sets, freq[key] // 2)
	sets -= d
	freq[key] -= d * 2
	res += d * 2
	if sets == 0:
		break
for key in freq:
	if freq[key] > 0 and sets > 0:
		sets -= 1
		res += 1
print(res)


from collections import Counter
(n, k) = map(int, input().split())
l = []
for _ in range(n):
	l.append(int(input()))
s = Counter(l)
a = []
b = []
for x in s:
	a.append(s[x] // 2)
	if s[x] % 2 != 0:
		b.append(s[x] % 2)
if n % 2 == 0:
	i = n // 2
else:
	i = n // 2 + 1
print(i - sum(a) - sum(b) + n)


(n, k) = map(int, input().split())
ar = []
for i in range(n):
	ar.append(int(input()))
cnt = []
for i in range(1, k + 1):
	cnt.append(ar.count(i))
odd = 0
for i in cnt:
	if i & 1:
		odd += 1
print(n - odd // 2)


(n, k) = [int(x) for x in input().split(' ')]
fd = {}
for student in range(n):
	x = int(input())
	if x in fd.keys():
		fd[x] += 1
	else:
		fd[x] = 1
ans = sum([i % 2 for i in fd.values()]) // 2
print(n - ans)


(a, b) = list(map(int, input().split()))
n = [0] * b
for i in range(a):
	k = int(input())
	n[k - 1] += 1
cnt = 0
for x in n:
	cnt += x % 2
print(a - cnt // 2)


from collections import *
n = int(input().split()[0])
c = Counter((input() for _ in [0] * n))
print(n - sum((c[k] % 2 for k in c)) // 2)


(n, k) = map(int, input().split())
a = [int(input()) for _ in range(n)]
fr = {}
for x in a:
	if x in fr:
		fr[x] += 1
	else:
		fr[x] = 1
(ans, odd) = (0, 0)
for (x, cnt) in fr.items():
	ans += cnt - cnt % 2
	if cnt % 2 == 1:
		odd += 1
print(ans + (odd + 1) // 2)


import sys

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

def get():
	return int(sys.stdin.readline().strip())

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

def getli():
	return list(map(int, sys.stdin.readline().strip().split()))
(n, k) = geti()
A = [0] * (k + 1)
for i in range(n):
	p = get()
	A[p] += 1
cnt = 0
for i in range(1, k + 1):
	cnt += A[i] // 2
if n % 2:
	print(cnt * 2 + (n // 2 - cnt + 1))
else:
	print(cnt * 2 + (n // 2 - cnt))


(n, k) = map(int, input().split())
a1 = 0
a2 = 0
l1 = []
l2 = []
if n % 2 == 0:
	max = n // 2
else:
	max = (n + 1) // 2
for i in range(n):
	x = int(input())
	l1.append(x)
s1 = list(set(l1))
for i in range(len(s1)):
	l2.append(l1.count(s1[i]))
for i in range(len(l2)):
	a1 = a1 + l2[i] // 2
	a2 = a2 + l2[i] % 2
print(n - a1 - a2 + max)


import math
ceil = math.ceil
l1 = [int(x) for x in input().split()]
(n, k) = map(int, l1)
c = []
d = [0] * k
for i in range(n):
	temp = int(input())
	d[temp - 1] += 1
d.sort(reverse=True)
for j in range(int(n / 2) + n % 2):
	if d[0] == 1:
		d.remove(1)
	else:
		d[0] -= 2
		if d[0] == 0:
			d.remove(0)
	d.sort(reverse=True)
print(n - sum(d))


(x, y) = map(int, input().split())
d = {}
for i in range(1, y + 1):
	d[i] = 0
for i in range(0, x):
	m = int(input())
	d[m] += 1
l = list(d.values())
c = 0
for i in range(0, len(l)):
	if l[i] % 2 != 0:
		c += 1
print(x - c // 2)


import math
(n, k) = list(map(int, input().split()))
am = [0] * k
for i in range(n):
	b = int(input())
	am[b - 1] += 1
am.sort(reverse=True)
even = []
tot = 0
now = math.ceil(n / 2)
for i in range(len(am)):
	tot += am[i] - am[i] % 2
	now -= (am[i] - am[i] % 2) // 2
	am[i] -= am[i] - am[i] % 2
for i in range(len(am)):
	tot += am[i]
	now -= am[i]
	if now == 0:
		break
print(tot)


(n, k) = list(map(int, input().split()))
d = {}
for i in range(n):
	x = int(input())
	if x in d:
		d[x] += 1
	else:
		d[x] = 1
arr = []
for i in d:
	arr.append(d[i])
arr.sort()
arr = arr[-1::-1]
prev = 0
ans = 0
for i in arr:
	if i % 2 != 0:
		prev += 1
print(sum(arr) - prev // 2)


(n, k) = map(int, input().split())
arr = [0] * k
for i in range(n):
	a = int(input())
	arr[a - 1] += 1
arr.sort()
x = n // 2
if n % 2 == 1:
	x += 1
for i in range(x):
	arr[-1] -= 2
	if arr[-1] == -1:
		arr[-1] = 0
	arr.sort()
counter = 0
for a in arr:
	counter += a
print(n - counter)


(n, m) = map(int, input().split())
arr = [0 for i in range(m + 1)]
for i in range(n):
	x = int(input())
	arr[x] += 1
t = (n + 1) // 2
total = 0
for i in range(m + 1):
	t -= arr[i] // 2
	total += arr[i] if arr[i] % 2 == 0 else arr[i] - 1
print(total + (n - total + 1) // 2)


inp = list(map(int, input().split()))
(n, k) = (inp[0], inp[1])
a = [0] * k
sobo = int(n // 2)
if n % 2 == 1:
	sobo += 1
t = 0
chan = 0
for i in range(n):
	t = int(input())
	a[t - 1] += 1
	if a[t - 1] % 2 == 0:
		chan += 1
print(chan * 2 + (sobo - chan))


(n, k) = map(int, input().split())
K = [0] * k
odd = 0
for _ in range(n):
	K[int(input()) - 1] += 1
for i in K:
	if i % 2 == 1:
		odd += 1
print(n - odd // 2)


(n, k) = map(int, input().split())
arr = [0] * (k + 1)
oddsCount = 0
res = 0
i = 0
while i < n:
	index = int(input())
	arr[index] += 1
	i += 1
for i in range(1, k + 1):
	if arr[i] == 1:
		oddsCount += 1
		continue
	if arr[i] % 2 == 0:
		res += arr[i]
	if arr[i] % 2 == 1:
		oddsCount += 1
		res += arr[i] - 1
res += oddsCount // 2 + oddsCount % 2
print(res)


from sys import stdin
input = stdin.readline
R = lambda : int(input())
(n, m) = map(int, input().split())
v = [0] * m
o = 0
for i in range(n):
	v[R() - 1] += 1
for i in v:
	if i % 2:
		o += 1
s = sum(v) - o
n = (n + 1) // 2
r = n - s // 2
print(s + min(r, o))


(n, k) = list(map(int, input().split()))
A = [0] * (k + 1)
count = 0
for _ in range(n):
	In = int(input())
	A[In] += 1
	if A[In] == 2:
		count += 1
		A[In] = 0
Ans = count * 2
if n % 2 == 0:
	count = n // 2 - count
else:
	count = n // 2 - count + 1
print(Ans + count)


from collections import defaultdict as dc
(n, m) = [int(i) for i in input().split()]
p = dc(int)
for _ in range(n):
	a = int(input())
	p[a] += 1
s = 0
for i in range(1, m + 1):
	s = s + p[i] % 2
print(n - s // 2)


(n, k) = map(int, input().split())
d = 1001 * [0]
f = []
if n % 2 == 0:
	r = n
else:
	r = n + 1
for t in range(n):
	a = int(input())
	if not d[a]:
		f.append(a)
	d[a] += 1
ans = 0
for t in f:
	if d[t] % 2 == 0:
		r -= d[t]
		ans += d[t]
	else:
		r -= d[t] - 1
		ans += d[t] - 1
print(ans + int(r / 2))


from math import ceil
(n, k) = map(int, input().split())
amount = [0] * k
ans = 0
a = ceil(n / 2)
kits = 0
for i in range(n):
	amount[int(input()) - 1] += 1
amount.sort(reverse=True)
for i in range(k):
	if amount[i] != 1:
		if kits + amount[i] // 2 <= a:
			ans += amount[i] - amount[i] % 2
			kits += amount[i] // 2
			amount[i] = amount[i] % 2
		else:
			kits += a - kits
			ans += (a - kits) * 2
i = 0
while kits < a:
	if amount[i]:
		kits += 1
		ans += 1
	i += 1
print(min(n, ans))


(n, k) = map(int, input().split())
a = [0] * 10001
cnt = n // 2 + n % 2
for i in range(n):
	num = int(input())
	a[num] += 1
ans = 0
for i in range(1, 1 + k):
	while a[i] > 1 and cnt > 0:
		a[i] -= 2
		ans += 2
		cnt -= 1
for i in range(1, 1 + k):
	if a[i] != 0 and cnt > 0:
		ans += 1
		cnt -= 1
print(ans)


import sys
from collections import deque
IS_LOCAL = False

def read_one(dtype=int):
	return dtype(input())

def read_multiple(f, dtype=int):
	return f(map(dtype, input().split()))

def swap(x, y):
	return (y, x)

def main():
	(n, k) = (5, 3)
	a = [1, 3, 1, 1, 2]
	if not IS_LOCAL:
		(n, k) = read_multiple(tuple)
		a = []
		for i in range(n):
			a.append(read_one())
	d = dict()
	for i in a:
		d[i] = d.get(i, 0) + 1
	res = 0
	for x in d.values():
		res += 2 * (x // 2)
	t = (n + 1) // 2 - res // 2
	res += t
	print(res)
if len(sys.argv) > 1 and sys.argv[1] == 'True':
	IS_LOCAL = True
main()


(n, k) = map(int, input().split())
tms = (n + 1) // 2
c = [0] * k
for i in range(n):
	c[int(input()) - 1] += 1
ans = 0
for i in range(tms):
	flg = 0
	for j in range(k):
		if c[j] >= 2:
			ans += 2
			c[j] -= 2
			flg = 1
			break
	if flg == 1:
		continue
	for j in range(k):
		if c[j] >= 1:
			ans += 1
			c[j] -= 1
			break
print(ans)


import math
(n, k) = input().split()
(n, k) = (int(n), int(k))
a = []
for i in range(n):
	a.append(input())
max_porc = math.ceil(n / 2)
a = sorted(a)
pairs_count = 0
pairs = []
flag = False
for i in range(len(a) - 1):
	if flag:
		flag = False
		continue
	if a[i] == a[i + 1]:
		pairs_count += 1
		pairs.append(a[i])
		flag = True
happy = 0
happy += pairs_count * 2
n -= pairs_count * 2
max_porc -= pairs_count
happy += max_porc
print(happy)


import math
(n, k) = map(int, input().split())
en = math.ceil(n / 2)
l = []
for e in range(n):
	l.append(int(input()))
dzerieni = [0 for e in range(k + 1)]
for el in l:
	dzerieni[el] += 1
komplekti = 0
vieni = 0
for d in dzerieni:
	komplekti += d // 2
	vieni += d % 2
apmierinatie = komplekti * 2 + (vieni + 1) // 2
print(apmierinatie)


t = 1
for _ in range(t):
	(n, k) = map(int, input().split())
	l = [int(input()) for i in range(n)]
	maxi = -1000000
	dict1 = {}
	(good, bad) = (0, 0)
	for i in l:
		dict1[i] = dict1.get(i, 0) + 1
		if dict1[i] == 2:
			good += 2
			dict1[i] = 0
	for i in dict1:
		if dict1[i] == 1:
			bad += 1
	factor = 0
	if n % 2 == 1:
		factor = 1
	print(good + bad // 2 + factor)


import math
(n, k) = [int(x) for x in input().split()]
d = {}
for j in range(n):
	w = input()
	if w not in d:
		d[w] = 0
	d[w] += 1
need = 0
for val in d.values():
	need += math.ceil(val / 2)
if need > math.ceil(n / 2):
	print(n - (need - math.ceil(n / 2)))
else:
	print(n)


(n, k) = map(int, input().split())
a = []
s = set()
ans = 0
k = 0
for i in range(n):
	a = int(input())
	if a in s:
		s.remove(a)
		ans += 2
		k += 1
	else:
		s.add(a)
print(ans + (n // 2 + n % 2) - k)


import math
from collections import Counter
(n, k) = map(int, input().split())
c = Counter()
for i in range(n):
	x = int(input())
	c[x] += 1
a = int(math.ceil(n / 2))
d = list(c.values())
d.sort(reverse=True)
i = 0
x = 0
for i in d:
	x += i // 2
print(x + a)


import math
(n, k) = [int(c) for c in input().split()]
l = []
for i in range(n):
	temp = int(input())
	l.append(temp)
favors = [0] * k
for f in l:
	favors[f - 1] += 1
total = math.ceil(n / 2)
favors = sorted(favors, reverse=True)
res = 0
to_del = []
for i in range(k):
	if favors[i] % 2 == 0:
		res += favors[i]
		total -= int(favors[i] / 2)
		to_del.append(i)
to_del = sorted(to_del, reverse=True)
for i in to_del:
	del favors[i]
ind = 0
for i in range(total):
	favors[ind] -= 2
	if favors[ind] == 0:
		res += 2
		ind += 1
	elif favors[ind] < 0:
		res += 1
		ind += 1
		if ind < len(favors):
			favors[ind] -= 1
	else:
		res += 2
print(res)


(n, k) = map(int, input().split())
used = [False] * k
a = []
d = [0] * (k + 1)
t = (n + 1) // 2
for i in range(n):
	b = int(input())
	a.append(b)
	d[b] += 1
s = 0
for i in range(1, k + 1):
	if t - d[i] // 2 >= 0:
		t -= d[i] // 2
		s += d[i] // 2 * 2
	else:
		s += t * 2
		t = 0
i = 1
while t != 0 and i != k + 1:
	if d[i] % 2 != 0:
		s += 1
		t -= 1
	i += 1
print(s)


import math
(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	a[int(input()) - 1] += 1
box = math.ceil(n / 2)
max = 0
for i in range(k):
	box -= a[i] // 2
	max += a[i] // 2 * 2
max += box
print(max)


import sys
import copy
sys.setrecursionlimit(1000000)
from collections import defaultdict
(n, k) = map(int, input().split())
dic = defaultdict(int)
for i in range(n):
	x = int(input())
	dic[x] += 1
ans = 0
bad = 0
for key in dic:
	d = dic[key]
	ans += d // 2 * 2
	bad += d % 2
print(ans + (bad + 2 - 1) // 2)


import math
(n, k) = map(int, input().split())
a = []
for i in range(n):
	a.append(int(input()))
l = list(set(a))
l.sort()
for i in range(len(l)):
	l[i] = a.count(l[i])
s = 0
for i in range(len(l)):
	s = s + l[i] % 2
print(n - s // 2)


import sys
inp = sys.stdin.readline().strip().split(' ')
n = int(inp[0])
allPacks = (n + 1) // 2
k = int(inp[1])
ans = 0
drinks = {}
for a in range(n):
	drink = sys.stdin.readline()
	try:
		drinks[drink] += 1
		if drinks[drink] > 1:
			drinks[drink] -= 2
			ans += 2
			allPacks -= 1
	except:
		drinks[drink] = 1
ans += allPacks
print(ans)


(n, k) = list(map(int, input().split()))
s = {}
for i in range(n):
	a = int(input())
	if a in s.keys():
		s[a] += 1
	else:
		s[a] = 1
q = list(s.keys())
p = 0
l = 0
for i in range(len(q)):
	if s[q[i]] % 2 == 0:
		p += s[q[i]] // 2
	else:
		p += s[q[i]] // 2
		l += 1
m = (n + 1) // 2
if p >= m:
	print(p * 2)
else:
	print(p * 2 + (m - p))


import itertools

def main():
	(n, r) = [int(v) for v in input().split()]
	data = []
	for i in range(n):
		data.append(int(input()))
	freq = {}
	for v in data:
		if v not in freq:
			freq[v] = 0
		freq[v] += 1
	s = 0
	ch_c = 0
	for (k, v) in freq.items():
		if v % 2 == 0:
			s += v
		else:
			ch_c += 1
			s += v - 1
	if ch_c % 2 == 0:
		s += ch_c // 2
	else:
		s += ch_c // 2 + 1
	print(s)
main()


(n, k) = map(int, input().split())
d = dict([(i + 1, 0) for i in range(k)])
for _ in range(n):
	drink = int(input())
	d[drink] += 1
satisfied = 0
flag = n % 2
odds = []
for drink in range(1, k + 1):
	if d[drink] % 2 == 0:
		satisfied += d[drink]
	else:
		odds.append(d[drink])
odds.sort()
odds_satisfied = len(odds) // 2 + n % 2
for i in range(len(odds)):
	if odds_satisfied > 0:
		satisfied += odds[len(odds) - 1 - i]
		odds_satisfied -= 1
	else:
		satisfied += odds[len(odds) - 1 - i] - 1
print(satisfied)


(n, k) = map(int, input().split())
a = [0] * k
b = []
e = o = 0
for _ in range(n):
	t = int(input())
	a[t - 1] += 1
for i in range(k):
	if a[i] % 2 == 0:
		b.append(a[i])
		e += 1
for i in range(k):
	if a[i] % 2 == 1:
		b.append(a[i])
		o += 1
c = 0
for i in range(e):
	c += b[i]
j = 0
for i in range(e, k):
	if j % 2 == 0:
		c += b[i]
		j += 1
	else:
		c += b[i] - 1
		j += 1
print(c)


from math import ceil
(n, k) = list(map(int, input().split()))
a = [0] * k
for i in range(n):
	q = int(input())
	a[q - 1] += 1
j = 0
ans = 0
for i in a:
	j += i // 2
	ans += i % 2
print(n - (ans - (ceil(n / 2) - j)))


(n, k) = map(int, input().split())
a = [0] * k
for i in range(n):
	b = int(input())
	a[b - 1] += 1
a.sort()
r = 0
ne = 0
for i in a:
	r += i // 2 * 2
	ne += i % 2
print(r + (ne + 1) // 2)


from math import *
(n, k) = map(int, input().split())
mas = [0] * k
ans = 0
s = 0
for i in range(n):
	o = int(input())
	mas[o - 1] += 1
	if mas[o - 1] == 2 and s < ceil(n / 2):
		ans += 2
		mas[o - 1] -= 2
		s += 1
for i in range(k):
	if s < ceil(n / 2) and mas[i] == 1:
		ans += 1
		s += 1
print(ans)


import sys
import math
from collections import defaultdict
from collections import Counter
(n, k) = map(int, input().split())
a = []
for _ in range(n):
	a.append(int(input()))
d = Counter(a)
c = 0
c1 = 0
f = 0
for x in d:
	c += d[x] - d[x] % 2
	c1 += d[x] // 2
	if c1 == math.ceil(n / 2):
		f = 1
		break
if f == 1:
	print(c)
else:
	for x in d:
		c += 1
		c1 += 1
		if c1 == math.ceil(n / 2):
			break
	print(c)


import math
nm = input().split()
n = int(nm[0])
m = int(nm[1])
a = dict()
ans = 0
for i in range(n):
	ai = int(input())
	if a.__contains__(ai):
		a.update({ai: a.get(ai) + 1})
	else:
		a.update({ai: 1})
sets = 0
maxsets = math.ceil(n / 2)
for el in a:
	if a.get(el) % 2 != 0:
		continue
	else:
		no_of_setreqd = a.get(el) / 2
		sets += no_of_setreqd
		ans += no_of_setreqd * 2
temp = 0
if sets < maxsets:
	for el in a:
		if a.get(el) % 2 != 0:
			temp = int(a.get(el) / 2)
			sets += temp
			ans += temp * 2
if sets < maxsets:
	setsleft = maxsets - sets
	ans += setsleft
print(int(ans))


(n, k) = map(int, input().split())
from collections import defaultdict
k = (n + 1) // 2
full = 0
odd = 0
count = defaultdict(int)
for x in range(n):
	x = int(input())
	count[x] += 1
for (key, v) in count.items():
	full += v // 2
	odd += v % 2
total = 0
step = min(k, full)
k -= step
total += step * 2
step = min(odd, k)
total += step
print(total)