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 clen = length cs
    let dlen = length ds
    case () of
        _ | length (group vs) == 1 -> print (n `div` 2)
          | head cs == head ds -> do
                if length cs < length ds
                    then do
                        if null css
                            then print $ length cs + length (concat dss)
                            else print $ (n `div` 2) - length (head css) + length (concat dss)
                    else do
                        if null dss
                            then print $ length ds + length (concat css)
                            else print $ (n `div` 2) - length (head dss) + length (concat css)
          | otherwise -> print $ length (concat css) + length (concat dss)
