
object Main extends App{
  import scala.io.StdIn._
  import scala.math.abs
  var stack = Nil : List[Int]
  val n = readLine.trim.toInt
  val slimes = readLine.trim.split(' ').map(_.toInt)
  var length = 1
  var prev = 0
  for (slime ← slimes){
    if (prev == slime){
      length += 1
    }else{
      if (length > 1) stack = length::stack
      prev = slime
      length = 1
    }
  }
  if (length > 1)  stack = length :: stack
  println(stack.map{_ / 2}.sum)
}