import Array._
object Main{
  
  def main(args:Array[String]):Unit={
    var len = readInt
    var nums = readLine.split(" ").map(x => x.toInt)
    var recordLeft:Map[Int,Int] = Map()
    var recordRight:Map[Int,Int] = Map()
    var res = 0
    for(i <- 0 until len){
      if(len%2==0){
        var tmp = recordLeft.getOrElse(nums(i),0)
        tmp+=1
        recordLeft += (nums(i) -> tmp)
      }
      else{
        var tmp = recordRight.getOrElse(nums(i),0)
        tmp+=1
        recordRight += (nums(i) -> tmp)
      }
      
    }
    var resLeft = calculate(recordLeft)
    var resRight = calculate(recordRight)
    if(resLeft(0)._1 != resRight(0)._1){
      res = len - resLeft(0)._2 - resRight(0)._2
    }else if(resLeft(0)._1 == resRight(0)._1 && resLeft(0)._2>resRight(0)._2){
      res = len - resLeft(0)._2 -resRight(1)._2
    }else{
      res = len - resLeft(1)._2 - resRight(0)._2
    }
    
     println(res)
  }
  
  def calculate(r:Map[Int,Int]):Array[(Int,Int)]={
    var keys = r.keySet.toArray
    var tmpR:Array[(Int,Int)] = Array((0,0),(0,0))
    var max = 0
    for(i <- 0 until keys.length){
      var tmpMax = scala.math.max(max,r.getOrElse(keys(i),0))
      if(tmpMax!=max){
        max = tmpMax
        tmpR(1) = tmp(0)
        tmpR(0) = (keys(i),max)
      }
    }
    return tmpR
  }
}