n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i != n:
        if i+1 == l[i]:
            a = l[i]
            b = l[i+1]
            l[i]=b
            l[i+1]=a
            ans += 1
    else:
        if i+1 == l[i]:
            ans += 1
print(ans)