fun intList() = readLine()?.split(" ")?.map(String::toInt) ?: TODO()
fun main() {
    val n = readLine()?.toInt() ?: return
    val a = intList()
    val map = hashMapOf<Int, Int>()
    a.forEach {
        map[it] = map.getOrDefault(it, 0) + 1
    }
    val one = map.values.size
    val two = map.values.count { it == 2 || (it > 2 && it % 2 == 0) }
    println((one - (two % 2)).toString())
}
