using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using static kyoupuro.Input;
using static kyoupuro.MyMath;

namespace kyoupuro {

    class MainClass {

        public static void Main() {
            var N = NextInt();
            var A = IntList();

            var count = A.Distinct().Count();

            Console.WriteLine(count - 1 + count % 2);
        }
    }

    class MyMath {
        public const long mod = 1000000007;

        public static long Gcd(long a, long b) {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static List<long> Factor(long n) {
            var list = new List<long>();
            n = DivideToLimit(n, 2, list);
            n = DivideToLimit(n, 3, list);
            long sqrt = Sqrt(n);
            for (int i = 5; i <= n && i <= sqrt; i += 4) {
                n = DivideToLimit(n, i, list);
                i += 2;
                n = DivideToLimit(n, i, list);
            }
            if (n > 1) list.Add(n);
            return list;
        }

        public static long Sqrt(long n) {
            if (n < 0) return 0;
            long a = 0, tmp = 0, b = 0;
            for (int i = 62; i >= 0; i -= 2) {
                tmp = (b << 1) + 1 <= (n >> i) ? 1 : 0;
                a = a << 1 | tmp;
                n -= (((b << 1) + 1) * tmp) << i;
                b = (b << 1) + tmp + tmp;
            }
            return a;
        }

        static long DivideToLimit(long divisor, long dividend, List<long> list) {
            while (divisor % dividend == 0) {
                list.Add(dividend);
                divisor /= dividend;
            }
            return divisor;
        }
    }

    public class PriorityQueue<T> : IEnumerable<T> {

        readonly List<T> _data = new List<T>();
        readonly IComparer<T> _comparer;

        public PriorityQueue(IComparer<T> comparer) {
            _comparer = comparer;
        }

        public PriorityQueue() : this(Comparer<T>.Default) { }

        public void Enqueue(T item) {
            _data.Add(item);

            int childID = _data.Count - 1;
            int parentID = (childID - 1) / 2;

            while (childID > 0 && _comparer.Compare(_data[parentID], _data[childID]) > 0) {
                Swap(parentID, childID);
                childID = parentID;
                parentID = (parentID - 1) / 2;
            }
        }

        public T Dequeue() {
            var first = _data.First();
            _data[0] = _data.Last();
            _data.RemoveAt(_data.Count - 1);

            int parentID = 0;
            int childID = parentID * 2 + 2;
            if (childID >= _data.Count || _comparer.Compare(_data[childID], _data[childID - 1]) > 0) childID--;

            while (childID < _data.Count && _comparer.Compare(_data[parentID], _data[childID]) > 0) {
                Swap(parentID, childID);
                parentID = childID;
                childID = parentID * 2 + 2;
                if (childID >= _data.Count || _comparer.Compare(_data[childID], _data[childID - 1]) > 0) childID--;
            }

            return first;
        }

        void Swap(int parent, int child) {
            var tmp = _data[parent];
            _data[parent] = _data[child];
            _data[child] = tmp;
        }

        public T Peek() { return _data[0]; }
        public int Count => _data.Count;

        public IEnumerator<T> GetEnumerator() {
            foreach(var item in _data) {
                yield return item;
            }
        }

        IEnumerator IEnumerable.GetEnumerator() {
            return GetEnumerator();
        }
    }

    class Input {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line() {
            return Console.ReadLine();
        }

        public static int NextInt() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return int.Parse(enumerator.Current);
        }

        public static long NextLong() {
            while (!enumerator.MoveNext()) {
                enumerator = StrArr().AsEnumerable().GetEnumerator();
            }
            return long.Parse(enumerator.Current);
        }

        public static string[] StrArr() {
            return Line().Split(' ');
        }

        public static List<int> IntList() {
            return StrArr().Select(int.Parse).ToList();
        }

        public static List<long> LongList() {
            return StrArr().Select(long.Parse).ToList();
        }
    }
}

Measured memory_bytes: 19936