n = int(input())
P = list(map(int, input().split()))

cnt = [0]*n
for i in range(n):
    if P[i] == i+1:
        cnt[i] += 1

cnt += [0]
# print(cnt)
ans, i = 0, 0
while i < n-1:
    if cnt[i] == 1 and cnt[i+1] == 1:
        ans += 1
        i += 2
    elif cnt[i] == 1 and cnt[i+1] != 1:
        ans += 1
        i += 1
    else:
        i += 1


print(ans)
