import itertools


N = int(input())

ans = 0
flags = [0 for _ in range(N)]
for idx, p in enumerate(map(int, input().split())):
    if idx + 1 == p:
        flags[idx] = 1

for key, elems in itertools.groupby(flags):
    elems = list(elems)
    len_elems = len(elems)
    if key == 1:
        if len_elems == 1:
            ans += 1
        else:
            ans += len_elems - 1

print(ans)
