import Data.List

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

counting = (++[(0, 0)]) . sortBy (flip compare) . 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
  | otherwise = min (n - oc - secondc es) (n - ec - secondc os)
  where
    (oc, ov) = head os
    (ec, ev) = head es
    secondc = fst . head . tail

main = calc <$> readLn <*> (map counting . transpose . splitRec 2 . map (read :: String -> Int) . words <$> getLine) >>= print