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

a = 0
for i in range(n-1):
    if p[i] == i+1 and p[i+1] == i+2:
        a += 1

b = 0
for i in range(n):
    if p[i] == i+1:
        b += 1

print(b-a)