from collections import Counter



n = int(eval(input()))

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

a = sorted(a)

d = Counter(a)

cnt = 0

for v in list(d.values()):

    if v % 2 == 0:

        cnt += 1



if cnt % 2 != 0:

    print((len(d)- 1))

else:

    print((len(d)))
import sys

from collections import Counter



sys.setrecursionlimit(10 ** 7)

input = sys.stdin.readline

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))

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

    D = Counter(A)

    ev = 0

    od = 0

    for k, v in list(D.items()):

        if v % 2 == 0:

            ev += 1

        else:

            od += 1

    if ev % 2 == 0:

        print((ev + od))

    else:

        print((ev + od - 1))





if __name__ == '__main__':

    resolve()

from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
a = sorted(a)
d = Counter(a)
cnt = 0
for v in list(d.values()):
    if v % 2 == 0:
        cnt += 1
if cnt % 2 != 0:
    print((len(d) - 1))
else:
    print((len(d)))

import sys
from collections import Counter

sys.setrecursionlimit(10**7)
input = sys.stdin.readline
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    D = Counter(A)
    ev = 0
    od = 0
    for k, v in list(D.items()):
        if v % 2 == 0:
            ev += 1
        else:
            od += 1
    if ev % 2 == 0:
        print((ev + od))
    else:
        print((ev + od - 1))


if __name__ == "__main__":
    resolve()

+import sys -n = int(eval(input())) -a = list(map(int, input().split())) -a = sorted(a) -d = Counter(a) -cnt = 0 -for v in list(d.values()): -    if v % 2 == 0: -        cnt += 1 -if cnt % 2 != 0: -    print((len(d) - 1)) -else: -    print((len(d))) +sys.setrecursionlimit(10**7) +input = sys.stdin.readline +f_inf = float("inf") +mod = 10**9 + 7 + + +def resolve(): +    n = int(eval(input())) +    A = list(map(int, input().split())) +    D = Counter(A) +    ev = 0 +    od = 0 +    for k, v in list(D.items()): +        if v % 2 == 0: +            ev += 1 +        else: +            od += 1 +    if ev % 2 == 0: +        print((ev + od)) +    else: +        print((ev + od - 1)) + + +if __name__ == "__main__": +    resolve()