object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val x :: xs = List.fill(sc.nextInt())(sc.nextInt())
  val ((sum, count), _) = xs.foldLeft(0 -> 1 -> x) {
    case (((sum, count), l), r) =>
      (if (l == r) sum -> (count + 1) else (sum + count / 2) -> 1) -> r
  }
  println(sum + count / 2)
}
