import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val p = (1..n).map { sc.nextInt()-1 }

  val array = p.toIntArray()

  var count = 0
  for (i in 0 until n-1) {
    val a1 = array[i]

    if (a1 == i) {
      val a2 = array[i+1]
      array[i] = a2
      array[i+1] = a1
      count++
    }
  }
  val last1 = array[n-1]
  if (last1 == n-1) {
    count++
  }

  println(count)

}