package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)

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

	ans := 0
	for i := 0; i < n; i++ {
		if p[i] != i+1 {
			continue
		}
		if p[i+1] != i+1 && i != n-1 {
			tmp := p[i+1]
			p[i+1] = p[i]
			p[i] = tmp
			ans++
		} else if i != 0 {
			tmp := p[i-1]
			p[i-1] = p[i]
			p[i] = tmp
			ans++
		}
	}
	fmt.Println(ans)
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}
