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

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