import scala.annotation.tailrec

object Main extends App {
  @tailrec
  def loop(ints: List[Int], sum: Int, count: Int, l: Int): Int =
    ints match {
      case List() => sum + count / 2
      case r :: remaining =>
        loop(remaining, sum + (if (l == r) 0 else count / 2), if (l == r) count + 1 else 1, r)
    }

  val sc = new java.util.Scanner(System.in)
  val x :: xs = List.fill(sc.nextInt())(sc.nextInt())
  println(loop(xs, 0, 1, x))
}
