# ALC 005 D

N = int(input())
list_p = list(map(int, input().split()))
swapCount = 0

for i in range(N):
    if list_p[i] == i+1:
        temp = list_p[i]
        list_p[i] = list_p[i+1]
        list_p[i+1] = temp
        swapCount += 1

print(swapCount)