N = int(input())
p = list(map(int,input().split()))

ans = 0
for i in range(1,N+1):
    if i == p[i-1]:
        ans += 1

for i in range(1,N):
    if i == p[i-1] and i+1 == p[i]:
        ans -= 1
print(ans)
