import sys

from collections import Counter



N = int(sys.stdin.readline().strip())

A = list(map(int, sys.stdin.readline().strip().split()))

counter = Counter(A)



even_count = 0

for (n, count) in list(counter.items()):

    if count % 2 == 1:

        N -= count // 2 * 2

        counter[n] = 1

    else:

        N -= count - 2

        counter[n] = 2

        even_count += 1



print((N - (even_count + 1) // 2 * 2 ))
import sys

from collections import Counter



input = sys.stdin.readline

N = int(eval(input()))

A = list(map(int, input().split()))



counter = Counter(A)

# print(counter)

ans = 0

tmp = 0

for n, count in list(counter.items()):

    r = (count - 1) // 2

    count -= 1 + 2*r

    ans += 2*r

    if count == 1:

        tmp += 1



print((N - ans - tmp - tmp % 2))
import sys
from collections import Counter

N = int(sys.stdin.readline().strip())
A = list(map(int, sys.stdin.readline().strip().split()))
counter = Counter(A)
even_count = 0
for (n, count) in list(counter.items()):
    if count % 2 == 1:
        N -= count // 2 * 2
        counter[n] = 1
    else:
        N -= count - 2
        counter[n] = 2
        even_count += 1
print((N - (even_count + 1) // 2 * 2))

import sys
from collections import Counter

input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
counter = Counter(A)
# print(counter)
ans = 0
tmp = 0
for n, count in list(counter.items()):
    r = (count - 1) // 2
    count -= 1 + 2 * r
    ans += 2 * r
    if count == 1:
        tmp += 1
print((N - ans - tmp - tmp % 2))

-N = int(sys.stdin.readline().strip()) -A = list(map(int, sys.stdin.readline().strip().split())) +input = sys.stdin.readline +N = int(eval(input())) +A = list(map(int, input().split())) -even_count = 0 -for (n, count) in list(counter.items()): -    if count % 2 == 1: -        N -= count // 2 * 2 -        counter[n] = 1 -    else: -        N -= count - 2 -        counter[n] = 2 -        even_count += 1 -print((N - (even_count + 1) // 2 * 2)) +# print(counter) +ans = 0 +tmp = 0 +for n, count in list(counter.items()): +    r = (count - 1) // 2 +    count -= 1 + 2 * r +    ans += 2 * r +    if count == 1: +        tmp += 1 +print((N - ans - tmp - tmp % 2))