import scala.io.StdIn._

object Main extends App {
  val n = readInt()
  val v = readLine().split(" ").map(_.toInt).toSeq
  println(
    v.zipWithIndex
      .groupBy(_._2 % 2)
      .map { tuple =>
        val list = tuple._2.groupBy(_._1).toSeq
        val max  = list.maxBy(_._2.length)
        list.filterNot(_._2.length == max._2.length).map(_._2.length).sum
      }
      .sum
  )
}
