N = int(input())
p = list(map(int, input().split()))
cnt = 0
i = 0
while i < N:
    if i + 1 == p[i]:
        c = 1
        for j in range(i + 1, N):
            if j+1 != p[j]:
                i = j
                break
            else:
                c += 1
        i = j
        cnt += (c+1)//2
    i += 1

print(cnt)
        