#!usr/bim/python
#! -*- coding: utf-8 -*-

n = raw_input()
n = int(n)

pl = raw_input()
pl = pl.split()
pl = map(int,pl)

c = 0

i = 0
while i < n:
    p = pl[i]
    if i+1 == p:
        c += 1
        i += 2
    else:
        i += 1

print c
