object Main extends App {
	val N = scala.io.StdIn.readInt
	var A = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	var count = 0

	for(i<-0 until N-1){
		if(A(i) == i+1){
			count = count + 1;
			val temp = A(i)
			A(i) = A(i+1)
			A(i+1) = temp
		}
	}

	if(A(N-1) == N) count = count + 1;

	println(count)

}
