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