n = int(input())
p = list(map(int,input().split()))
l = [False]*n
for i,pi in enumerate(p):
    l[i] = i+1 == pi

ans = 0
for i in range(n-1):
    if l[i]:
        p[i],p[i+1] = p[i+1],p[i]
        l[i+1] = False
        l[i] = False
        ans += 1
print(ans)