fun main(args: Array<String>) {
    var N = readLine()
    var A = readLine()!!.split(' ').map { it.toInt() }.toMutableList()

    var res = 0

    if (A[0] == 1) {
        res++
        A.swap(0, 1)
    }

    for (i in 1..A.size-1) {
        if (A[i] == i+1) {
            res++
            A.swap(i, i-1)
        }
    }
    println(res)
}