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 lMax = Map.foldr max 0 lMap
    let rMax = Map.foldr max 0 rMap

    let (lfMapT,lfMapF) = partition (==lMax) lMap
    let (rfMapT,rfMapF) = partition (==rMax) rMap

    if size lfMapT == 1 && size rfMapT == 1 && keys lfMapT == keys rfMapT then do
        let lMax' = Map.foldr max 0 lfMapF
        let rMax' = Map.foldr max 0 rfMapF
        print $ min (n - lMax' - rMax) (n - lMax - rMax')
    else print (n - lMax - rMax)

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

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