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

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

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

        if v % 2 == 0:

            ev += 1



    print((len(D) if ev % 2 == 0 else len(D) - 1))





if __name__ == '__main__':

    resolve()

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
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
    for k, v in list(D.items()):
        if v % 2 == 0:
            ev += 1
    print((len(D) if ev % 2 == 0 else len(D) - 1))


if __name__ == "__main__":
    resolve()

-    od = 0 -        else: -            od += 1 -    if ev % 2 == 0: -        print((ev + od)) -    else: -        print((ev + od - 1)) +    print((len(D) if ev % 2 == 0 else len(D) - 1))