object Main extends App {
    val n: Int = io.StdIn.readLine().toInt
    var arr: Array[Int] = io.StdIn.readLine().split(' ').map(_.toInt)

    var count = 0
    for (i <- 0 until n - 1) {
      if (arr(i) == i + 1) {
        val temp = arr(i)
        arr(i) = arr(i + 1)
        arr(i + 1) = temp
        count = count + 1
      }
    }
    if(arr(n - 1) == n) count = count + 1
    println(count)
}
