import Data.List
import Data.Bits
import qualified Data.ByteString.Char8 as BC 

query :: [Int] -> Int
query = sum . map ((`shiftR` 1) . length) . group

main :: IO ()
main = do
  getLine
  ais <- unfoldr (BC.readInt . BC.dropWhile (== ' ')) <$> BC.getLine
  putStrLn $ show $ query ais