N = int(input())
P = [int(p) for p in input().split()]

ans = 0
i = 0
while i < N-1:
    if P[i] == i+1 and P[i+1] == i+2:
        ans += 1
        i += 1
    elif P[i] == i+1:
        ans += 1
    i += 1
        
if P[N-1] == N and P[N-2] != N-1:
    ans += 1

print(ans)