import Data.Map as Map -- Heap?

main = do
    n  <- read <$> getLine
    vs <- ((fmap read . words) <$> getLine) :: IO [Int]
    let lMap = Prelude.foldl createMap empty (oddLs vs)
    let rMap = Prelude.foldl createMap empty (evenLs vs)

    let lAns = Map.foldr max 0 lMap
    let rAns = Map.foldr max 0 rMap

    let lfMap = Map.filter (==lAns) lMap
    let rfMap = Map.filter (==rAns) rMap

    if keys lfMap == keys rfMap then do
        let lAns' = Map.foldr max 0 (Map.filter (/=lAns) lMap)
        let rAns' = Map.foldr max 0 (Map.filter (/=rAns) rMap)
        print $ min (n - lAns' - rAns) (n - lAns - rAns')
    else print (n - lAns - rAns)

createMap :: Map Int Int -> Int -> Map Int Int
createMap old n
    | member n old = insert n (old!n + 1) old
    | otherwise    = insert n 1 old

maxWithKey :: Int -> Int -> (Int,Int) -> (Int,Int)
maxWithKey k a (j,b) = (if a>b then k else j, max a b)

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

evenLs :: [a] -> [a]
evenLs []      = []
evenLs (x:[])  = []
evenLs (_:y:ys)= y:evenLs ys