N = map(int, input())
p = [int(s) for s in input().split()]
cnt = 0

for i, vs in enumerate(zip(p, p[1:])):

    if vs[0] == i + 1:

        p[i] = vs[1]
        p[i + 1] = vs[0]
        cnt += 1

print(cnt)