main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    ns <- map read . words <$> getLine :: IO [Int]
    print $ sim ns

sim :: [Int] -> Int
sim (a:b:ns)
    | a == (-1) = sim (b:ns)
    | a == b    = 1 + sim ((-1):ns)
    | otherwise = sim (b:ns)
sim _ = 0