import java.util.Scanner

object Main {

  def solve() = {
    val sc = new Scanner(System.in)
    val N = sc.nextInt()
    var ans = 0
    var prev = false
    (1 to N) foreach { i =>
      val p = sc.nextInt()
      if (prev) {
        ans += 1
        prev = false
      } else {
        prev = p == i
      }
    }
    if (prev) ans += 1
    println(ans)
  }

  def main(args: Array[String]): Unit = {
    solve()
  }
}
