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

a = []
ans = 0
for i in range(n):
    if i+1 == p[i]:
        a.append(i+1)
        ans += 1

m = len(a)
for i in range(m-1):
    if a[i] + 1 == a[i+1]:
        ans -= 1

print(ans)
