package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func stringLineScan() string {
	sc.Scan()
	return sc.Text()
}

var comb [][]int

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)
	n, _ := strconv.Atoi(stringLineScan())
	p := make([]int, n)
	for i := 0; i < n; i++ {
		p[i], _ = strconv.Atoi(stringLineScan())
	}
	ans := 0
	for i := 0; i < n-1; i++ {
		if p[i] == i+1 {
			p[i], p[i+1] = p[i+1], p[i]
			ans++
		}
	}
	fmt.Println(ans)
}
