n = int(input())
p = list(map(int,input().split()))
l = []
for i in range(n):
    if i+1==p[i]:
        l.append(i)
ans = len(l)
cnt = 0
for i in range(len(l)):
    if l[i]-1==l[i-1]:
        cnt += 1
    elif cnt>0:
        ans -= 1
        cnt = 0
    if i==len(l)-1 and cnt>0:
        ans -= 1
print(ans)