import Control.Monad
import Data.List
import Data.Ord
import qualified Data.ByteString.Char8 as B
import qualified Data.IntMap as M

mf n Nothing = Just n
mf n (Just a) = Just (n+a)

main = do
    n<-readLn::IO Int
    vs<-unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[Int]
    print $ sol vs
---
sol vs = minimum $ map (\n-> on n + enn n ) $ M.keys mo
    where
        os = map fst $ filter (odd.snd) $ zip vs [1..]
        es = map fst $ filter (even.snd) $ zip vs [1..]
        mo = foldl' (flip (M.alter (mf 1))) M.empty os
        me = foldl' (flip (M.alter (mf 1))) M.empty es
        se = sortBy (flip $ comparing snd) $ M.toList me
        on n = (length os) - (mo M.! n)
        enn n = case dropWhile ((==n).fst) se of
            [] -> length es
            ((_,x):_) -> length es - x
