package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := scanInt()
	p := make([]int, n)
	for i := range p {
		p[i] = scanInt()
	}

	ans := 0
	for i := range p {
		if p[i] == i+1 {
			p[i+1] = p[i]
			ans++
		}
	}
	fmt.Println(ans)
}
