fun main(args: Array<String>) {
    arc082d()
}

fun arc082d() {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map { it.toInt() }.toIntArray()

    var answer = 0
    for (i in 0 until n - 1) {
        if (pList[i] == i + 1) {
            val temp = pList[i]
            pList[i] = pList[i + 1]
            pList[i + 1] = temp
            answer++
        }
    }

    println(answer)
}
