import Data.List

splitRec _ [] = []
splitRec n xs = let (h, t) = splitAt n xs in h : splitRec n t

counting = sort . map (\es -> (length es, head es)) . group . sort 

calc n os es
  | ov /= ev || length (takeWhile ((==oc) . fst) os) > 1 || length (takeWhile ((==ec) . fst) es) > 1 = n - oc - ec
  | ol == 1 && el == 1 = div n 2
  | ol == 1 = div n 2 - secondc es
  | el == 1 = div n 2 - secondc os
  | otherwise = min (n - oc - secondc es) (n - ec - secondc os)
  where
    ol = length os
    el = length es
    (oc, ov) = head os
    (ec, ev) = head es
    secondc = fst . head . tail

main = do
    n <- readLn :: IO Int
    [os, es] <- map counting . transpose . splitRec 2 . map (read :: String -> Int) . words <$> getLine
    print $ calc n os es