object Main {
  def main(args: Array[String]) {
    val n = scala.io.StdIn.readLine().toInt
    val as = scala.io.StdIn.readLine().split(' ').map(_.toInt).toList
    val hist = group(as.sorted, (a:Int,b:Int) => a==b).map(_.length)
    val m = hist.map(a=>a-1).max
    val s = hist.map(a=>a-1).sum
    val ans = n - List(2*m, (s+1)/2*2).max
    println(ans)
  }

  def group[A](input: List[A], op: (A,A) => Boolean): List[List[A]] = {
    if (input == Nil)
      Nil
    else if (input.length == 1)
      List(input)
    else if (op(input(0), input(1)) == true) {
      val l = group(input.tail, op)
      (input(0) :: l(0)) :: l.tail
    } else
      List(input(0)) :: group(input.tail, op)
  }      
}
