def main():

    N = int(eval(input()))

    A = [int(i) for i in input().split()]

    from collections import Counter

    c = Counter(A)

    mc = c.most_common()

    ans = len(mc)

    need = 0

    for cnt in mc:

        if cnt[1] > 1:

            need += cnt[1] - 1

    print((ans if need % 2 == 0 else ans - 1))





if __name__ == '__main__':

    main()

def main():

    N = int(eval(input()))

    A = [int(i) for i in input().split()]

    from collections import Counter

    c = Counter(A)

    even = len([v for v in list(c.values()) if v % 2 == 0])

    ans = len(list(c.keys()))

    if even % 2 == 1:

        ans -= 1

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    from collections import Counter

    c = Counter(A)
    mc = c.most_common()
    ans = len(mc)
    need = 0
    for cnt in mc:
        if cnt[1] > 1:
            need += cnt[1] - 1
    print((ans if need % 2 == 0 else ans - 1))


if __name__ == "__main__":
    main()

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    from collections import Counter

    c = Counter(A)
    even = len([v for v in list(c.values()) if v % 2 == 0])
    ans = len(list(c.keys()))
    if even % 2 == 1:
        ans -= 1
    print(ans)


if __name__ == "__main__":
    main()

-    mc = c.most_common() -    ans = len(mc) -    need = 0 -    for cnt in mc: -        if cnt[1] > 1: -            need += cnt[1] - 1 -    print((ans if need % 2 == 0 else ans - 1)) +    even = len([v for v in list(c.values()) if v % 2 == 0]) +    ans = len(list(c.keys())) +    if even % 2 == 1: +        ans -= 1 +    print(ans)