N=int(input())
p=list(map(int,input().split()))

res = 0
flag=0
for i in range(N):
    if flag == 1:
        res += 1
        flag = 0
    else:
        if p[i] == i+1:
            flag = 1

print(res)