
import java.util.Scanner
//
fun _Do() {
    
    var scan = Scanner(System.`in`)
    
    val N_ = scan.nextInt()
    
    var ints = Array(N_,{0})
    for (i in ints.indices) {
        ints[i] = scan.nextInt()
    }
    
    //--------
    
    var count = 0

    var prev = false
    for(i in ints.indices){
        when(prev){
            true-> prev = false
            false ->
                if( ints[i] == (i+1) ) {
                    count += 1
                    prev = true
                }
        }
    }

    println(count)
}

//
fun main( argv : Array<String> ) {
    _Do()
}