import java.util.Scanner

import scala.collection.mutable

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val an = Array.fill(N)(sc.nextInt)
  val idxs = Array.range(1, N + 1)
  val map: mutable.Map[Int, Int] = mutable.Map()
  var cnt = 0

  for (i <- idxs) {
    if (an(i - 1) == i) {
      if (i < N) {
        val t = an(i - 1)
        an(i - 1) = an(i)
        an(i) = t
        cnt = cnt + 1
      } else {
        cnt = cnt + 1
      }
    }
  }

  println(cnt)

}
