N = int(input())
p = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    if i+1 == p[i]:
        if i == N-1:
            l = p[i]
            k = l[i-1]
            p[i] = k
            p[i-1] = l
            ans +=1
        else:
            l = p[i]
            k = p[i+1]
            p[i] = k
            p[i+1] = l
            ans +=1
print(ans)
