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

ans = 0
flag = False
for i in range(N-1):
    a= P[i]
    b= P[i+1]
    if a == i+1 and flag==True:
        P[i] = b
        P[i+1] = a
        ans += 1
        flag = True
    elif flag== False:
        flag= True
print(ans)