import Data.Traversable
import Data.List

main = do
  t <- getLine
  ps <- map read . words <$> getLine
  putStrLn . show . solve $ ps


solve :: [Int] -> Int
solve [] = 0
solve (x:[]) = 0
solve (x:y:[]) = if x == y then 1 else 0
solve ps =
  let l1 = sort $ everyOtherElem ps
      l2 = sort $ everyOtherElem (tail ps)
      (v1,mcnt1, scnt1) = countMax (head l1) 1 (head l1) 0 0 (tail l1)
      (v2,mcnt2, scnt2) = countMax (head l2) 1 (head l2) 0 0 (tail l2)
  in if v1 /= v2 then (length l1) - mcnt1 + (length l2) - mcnt2
    else min ((length ps) - mcnt1 - scnt2) ((length ps) - mcnt2 - scnt1)

countMax x cnt m cntmax cnt2nd [] = (if cnt > cntmax then x else m, max cnt cntmax, (max cnt2nd (min cnt cntmax)))
countMax x cnt m cntmax cnt2nd (s:sorted) =
  if x /= s then
    countMax s 1 (if cnt > cntmax then x else m) (max cnt cntmax) (max cnt2nd (min cnt cntmax)) sorted
  else
    countMax x (cnt+1) m cntmax cnt2nd sorted

everyOtherElem [] = []
everyOtherElem (x:[]) = [x]
everyOtherElem (x:y:xs) = x : everyOtherElem xs
