import Control.Applicative

main = do
    n <- readLn :: IO Int
    xs <- map read . words <$> getLine
    print $ solve 0 xs

solve :: Int -> [Int] -> Int
solve _ [] = 0
solve 0 (x:xs) = solve x xs
solve x1 (x2:xs)
    | x1 == x2 = 1 + (solve 0 xs)
    | otherwise = solve x2 xs
