import Control.Applicative
import Control.Arrow ((&&&))
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List
import Data.Char (isSpace)

main :: IO ()
main = solve <$> (flip div 2 <$> readLn) <*> f >>= print
  where
    f = readil B.readInt <$> B.getLine

solve :: Int -> [Int] -> Int
solve n vs = min (h ds us) (h us ds)
  where
    f (as, bs) [] = (as, bs)
    f (as, bs) (x:y:ys) = f (x:as, y:bs) ys
    (as, bs) = f ([], []) vs
    g = sortBy (flip compare) . map (length &&& head) . group . sort
    (ds, us) = (g as, g bs)
    h xs ys = n - (fst . head) xs + case filter (\(_,s) -> s /= ((snd . head) xs)) ys of
                                     [] -> n
                                     ((m,_):_) -> n - m

readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')
