import java.io.BufferedReader
import java.io.InputStreamReader
import java.io.PrintWriter

fun solve() {
    val n = inf.readLine()!!.toInt()
    var ans = 0
    var prev = -2
    inf.readLine()!!.split(' ').map(String::toInt).withIndex().forEach {
        if (it.value == it.index + 1) {
            if (it.index != prev + 1) {
                ans++
                prev = it.index
            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    solve()
    ouf.close()
}

val inf = BufferedReader(InputStreamReader(System.`in`))
val ouf = PrintWriter(System.out)