from copy import deepcopy
N = int(input())
P = list(map(int, input().split()))
P2 = deepcopy(P)

ans = 0
for i in range(N-1):
    if i+1 == P[i]:
        ans += 1
        P[i], P[i+1] = P[i+1], P[i]

ans2 = 0
for i in range(N-1, -1, -1):
    if i+1 == P2[i]:
        ans2 += 1
        P2[i], P2[i-1] = P2[i-1], P2[i]

print(min(ans, ans2))