object Main {
  import scala.io.StdIn.readLine
  def input[A](change: String => A) = readLine.split(" ").map(change(_))
  def main(args: Array[String]): Unit = {
    val n = input(a=>a).head.toCharArray.map(_.toInt)
    val i = input(a=>a).map(_.toInt).foldLeft((List(), List()): (List[Int], List[Int]))((acc, c) =>
      (acc._2, acc._1 :+ c)
    )
    println(new QC(i).ans)
  }
}

class QC(input: (List[Int], List[Int])) {
  val cmap = (countMap(input._1), countMap(input._2))
  val slist = (sortList(cmap._1), sortList(cmap._2))

  def countMap(a: List[Int]) = {
    a.foldLeft(Map(): Map[Int,Int])((acc,c) => {
      acc updated (c, acc.get(c).getOrElse(0) + 1)
    })
  }
  def sortList(a: Map[Int, Int]) = {
    val sum = a.values.sum
    (a.toSeq.map(k=>(k._1, sum-k._2)).sortBy(_._2), sum)
  }
  def ans(): String = {
    val a = if(slist._1._1.head._1 == slist._2._1.head._1) {
      val k = slist._1._1.head._2 + slist._2._1.tail.headOption.getOrElse((0, slist._2._2))._2
      val l = slist._1._1.tail.headOption.getOrElse((0, slist._2._2))._2 + slist._2._1.head._2
      if(k>l){ l } else { k }
    } else {
      slist._1._1.head._2 + slist._2._1.head._2
    }
    a.toString
  }
}
