#!/usr/bin/env python3

N = int(input())
P = list(map(int, input().split()))
T = [False for i in range(N)]
for i in range(N-1):
    if i+1 == P[i]:
        T[i] = True

cnt = 0
for i in range(N):
    if T[i] == True:
        T[i] = False
        cnt += 1
        if T[i+1] == True:
            T[i+1] = False

print(cnt)
