module Lib where

    import           Data.List

    oddList :: [a] -> [a]
    oddList []           = []
    oddList [x         ] = [x]
    oddList (x : _ : xs) = x : oddList xs

    evenList :: [a] -> [a]
    evenList []           = []
    evenList [_         ] = []
    evenList (_ : x : xs) = x : evenList xs


    main = do
        n   <- readLn :: IO Int
        ipt <- map read . words <$> getLine :: IO [Int]


        let
            l           = n `div` 2
            o           = f $ oddList ipt
            e           = f $ evenList ipt
            f           = (-) l . maximum . map length . group . sort
            x:y:_       = ipt
            in
                print $ if x == y then l else e + o