fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    var ans = 0
    for (i in 0 until n-1) {
        if (p[i]-1 == i) {
            val temp = p[i]
            p[i] = p[i+1]
            p[i+1] = temp
            ans++
        }
    }
    if (p.lastIndex == n) ans++
    println(ans)
}