import sys

from collections import Counter



read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

MOD = 1000000007





def main():

    N, *A = list(map(int, read().split()))



    counter = Counter(A)



    odd = even = 0

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

        if v % 2 == 0:

            even += 1

        else:

            odd += 1



    if even % 2 == 0:

        ans = odd + even

    else:

        ans = odd + even - 1



    print(ans)

    return





if __name__ == '__main__':

    main()

import sys



read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

MOD = 1000000007





def main():

    N, *A = list(map(int, read().split()))



    K = len(set(A))

    if K % 2 == 1:

        ans = K

    else:

        ans = K - 1



    print(ans)

    return





if __name__ == '__main__':

    main()

import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = list(map(int, read().split()))
    counter = Counter(A)
    odd = even = 0
    for v in list(counter.values()):
        if v % 2 == 0:
            even += 1
        else:
            odd += 1
    if even % 2 == 0:
        ans = odd + even
    else:
        ans = odd + even - 1
    print(ans)
    return


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = list(map(int, read().split()))
    K = len(set(A))
    if K % 2 == 1:
        ans = K
    else:
        ans = K - 1
    print(ans)
    return


if __name__ == "__main__":
    main()

-from collections import Counter -    counter = Counter(A) -    odd = even = 0 -    for v in list(counter.values()): -        if v % 2 == 0: -            even += 1 -        else: -            odd += 1 -    if even % 2 == 0: -        ans = odd + even +    K = len(set(A)) +    if K % 2 == 1: +        ans = K -        ans = odd + even - 1 +        ans = K - 1