main = do
    n <- (read :: String -> Int) <$> getLine
    as <- map read . words <$> getLine
    print $ go as
    return ()

go :: [Int] -> Int
go []  = 0
go [x] = 0
go (x:y:other)
    | x == y    = 1 + go other
    | otherwise = 0 + go (y:other)