n = int(input())
lst = list(map(int,input().split()))

cnt = 0
for i in range(n-1):
    if i+1 == lst[i]:
        tmp = lst[i+1]
        lst[i+1] = lst[i]
        lst[i] = tmp
        cnt += 1
else:
    if i+1 == lst[i]:
        cnt += 1
print(cnt)