module Main where

import Control.Applicative
import Control.Monad
import Data.List

f :: [Int] -> ([Int], [Int])
f []       = ([], [])
f (x:y:zs) = (x:xs, y:ys)
  where
    (xs, ys) = f zs

g :: [Int] -> [[Int]]
g xs = sortBy (\a b -> length b `compare` length a) . group . sort $ xs

main :: IO ()
main = do
    n <- readLn :: IO Int
    vs <- fmap read . words <$> getLine :: IO [Int]
    let (as, bs) = f vs
    let (cs:css) = g as
    let (ds:dss) = g bs
    let ans = case () of
            _ | head cs /= head ds -> length (concat css) + length (concat dss)
              | otherwise          ->
                    let (cs2, css2) = splitAt 1 css
                        (ds2, dss2) = splitAt 1 dss
                        ans1 = length (concat css) + length (concat (ds:dss2))
                        ans2 = length (concat dss) + length (concat (cs:css2))
                    in min ans1 ans2
    print ans
