from sys import stdin
import bisect
from math import factorial

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))

point = 0
if li[0] == 1:
    li[0],li[1] = li[1],li[0]
    point += 1
for i in range(n-1):
    if li[i]-1 == i:
        li[i],li[i+1] = li[i+1],li[i]
        point += 1
print(point)