import Control.Monad
import Data.List

main=do
    n<-readLn::IO Int
    as<-map read.words<$>getLine::IO [Int]
    print.sum $ unfoldr f as

f [] = Nothing
f aa@(a:as) = g $ span (==a) aa

g (x,y) = Just ((length x) `div` 2, y)