object Main{
  def main(args: Array[String]){
    val sc=new java.util.Scanner(System.in)
    val n=sc.nextInt()
    val vv=List.fill(n/2,2)(sc.nextInt())
    val v=vv.transpose
    val std=v.map(x=>(List(0,0)::mysort(x,Nil)).sortBy(-_(1)).take(2)).sortBy(l=>l(0)(1)-l(1)(1))
    std match{
      case List(a:List[List[Int]],b:List[List[Int]]) if a(0)(0)==b(0)(0) => println(n-(a(1)(1)+b(0)(1)))
      case List(a:List[List[Int]],b:List[List[Int]]) => println(n-(a(0)(1)+b(0)(1)))
    }
  }
  def mysort(l:List[Int],r:List[List[Int]]) : List[List[Int]] = {
    l match{
      case Nil => r
      case x::xs => mysort(
        xs filter (_!=x),
        (x :: 1+xs.count(_==x) :: Nil) :: r
      )
    }
  }
}