n = int(input())
P = list(map(int, input().split()))

r = 0
for i in range(n):
    if P[i] == i+1:
        if i!=n:
            P[i+1] = P[i]
            r += 1
        else:
            r += 1
print(r)