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

x = []

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

cnt = 0
e = -2
for i in x:
    if e != i-1:
        cnt += 1
        e = i
    else:
        e = i

print(cnt)