import Control.Monad
import Data.List
import Data.Ord

main = do
    n <- read <$> getLine
    v <- map read <$> words <$> getLine
    putStrLn $ show $ n - solve v

solve :: [Int] -> Int
solve v | ho /= eo  = length (head vo) + length (head ve)
        | otherwise = max (length (vo !! 0) + length (ve !! 1)) (length (vo !! 1) + length (ve !! 0))
  where
    [vo, ve] = map (reverse . sortBy (comparing length) . ([] :) . group . sort) $ uninterleave v
    [ho, eo] = map (head . head) [vo, ve]
    uninterleave []      = [[], []]
    uninterleave (h : t) = [b, h : a]
      where
        [a, b] = uninterleave t
