package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		a[i] = nextInt(sc)
		a[i]-- // 0-indexed
	}
	ans := 0
	for i := 0; i < n-1; i++ {
		if a[i] == i {
			a[i], a[i+1] = a[i+1], a[i]
			ans++
		}
	}
	fmt.Println(ans)
}
