import Control.Applicative
import Control.Monad
import Data.List

solve :: [Int] -> Int
solve xs = iter 0 xs
  where
    iter k []  = k
    iter k [_] = k
    iter k (a:b:cs)
        | a == b    = let k' = k + 1 in k' `seq` iter k' cs
        | otherwise = iter k (b:cs)

main :: IO ()
main = do
    n <- readLn :: IO Int
    as <- fmap read . words <$> getLine :: IO [Int]
    print $ solve as