let N = Int(readLine()!)!
let a = readLine()!.characters.split(" ").map{Int(String($0))!} + [0]
var cnt = 1
var ans = 0
for i in 1...N {
  if a[i-1] == a[i] {
    cnt += 1
  } else {
    ans += cnt/2
    cnt = 1
  }
}
print(ans)