package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func allAtoi(num []string) []int {
	conv := make([]int, len(num))
	for i, item := range num {
		conv[i], _ = strconv.Atoi(item)
	}
	return conv
}

func main() {
	nextLine()
	in := allAtoi(strings.Split(nextLine(), " "))
	dupIdx := []int{}
	for i, n := range in {
		idx := i + 1
		if idx == n {
			dupIdx = append(dupIdx, i)
		}
	}
	cnt := 0
	for i := range dupIdx {
		cnt++
		if i+1 >= len(in) {
			temp := in[i]
			in[i] = in[i-1]
			in[i-1] = temp
		} else {
			temp := in[i]
			in[i] = in[i+1]
			in[i+1] = temp
		}
	}
	fmt.Println(cnt)
}
