fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val pp = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    var cnt = 0

    for (i in 0..n-2) {
        if (pp[i] == i+1 || pp[i+1] == i+2) {
            val tmp = pp[i]
            pp[i] = pp[i+1]
            pp[i+1] = tmp
            cnt++
        }
    }

    println(cnt)
}