N = int(input())
p = list(map(int,input().split()))
ans = 0
for i in range(1, N+1):
    if i == p[i-1]:
        if i != 1:
            if i-1 == p[i-2]:
                pass
            else:
                ans += 1
        else:
            ans += 1
print(ans)
