fun main(args: Array<String>) {
  val N = readInt()
  val PN = readInts().toMutableList()
  var cnt = 0
  for (i in 0 until PN.size - 1) {
    val I = i + 1
    val L = PN[i]
    val R = PN[i + 1]
    if (L == I) {
      PN.swap(i, i + 1)
      cnt++
    }
  }
  println(cnt)
}

fun MutableList<Int>.swap(index1: Int, index2: Int) {
  val tmp = this[index1] // 'this' がリストに対応する
  this[index1] = this[index2]
  this[index2] = tmp
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readInts() = readStrings().map { it.toInt() }
fun readLong() = readString().toLong()
fun readLongs() = readStrings().map { it.toLong() }
