fun main(args:Array<String>) {
	val n=readLine()!!.toInt()
	var cards=n
	val a=readLine()!!.split(" ").map {it.toInt()}
			.groupBy {it}.map {it.value.size}
			.filter {it>=2}
	a.map {
		if(it%2==0){ cards-= (it-2); return@map 2}
		else       { cards-= (it-1); return@map 1}
	}.count{ it==2 }.let {
		cards-=(it+1)/2*2
		println(cards)
	}
	
	
}