n = input()
swap = 0
ai = list(int(i) for i in input().split())
for i in range(len(ai)-1):
    if i+1 == ai[i]:
        tmp = ai[i]
        ai[i] = ai[i+1]
        ai[i+1] = tmp
        swap = swap + 1
print(swap)
