import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)
import Data.List
import Data.Function

alternateSplit :: [a] -> ([a],[a])
alternateSplit = foldr (\x (l,r)-> (x:r,l)) ([],[])

solve :: [Int] -> Int
solve v = 
    if allSame v
       then length v `div` 2 
       else let (l,r) = alternateSplit v
             in countChange l + countChange r
  where
    allSame v = all (== head v) v
    f = length . minimumBy (compare `on` length) .  group . sort
    countChange v =
        if allSame v then 0 else f v

main :: IO ()
main = do
    n <- readLn :: IO Int
    v <- map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    print $ solve v
