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

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