import java.util.Scanner

fun main(args: Array<String>) {
  val cin = Scanner(System.`in`)
  val n = cin.nextInt()

  var p = Array<Int>(n, {0})

  for (i in 0.. n - 1) {
    p[i] = cin.nextInt()
  }

  var ct = 0
  var tmpForSwap: Int
  for (i in 0..n - 1) {
    if (p[i] == i + 1) {
      var j: Int
      if (i + 1 == n) {
        j = i - 1
      } else {
        j = i + 1
      }
      tmpForSwap = p[i]
      p[i] = p[j]
      p[j] = tmpForSwap
      ct++
    }
  }

  println(ct)
  cin.close()
}