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

cnt = 0
for i in range(n-1):
    if i+1!=L[i] and i+2!= L[i+1]:
        continue
    elif (i+1==L[i] and i+2 != L[i+1]) or (i+1!=L[i] and i+2 == L[i+1]):
        L[i],L[i+1] = L[i+1],L[i]
        cnt +=1
    elif i+1==L[i] and i+2 == L[i+1]:
        L[i],L[i+1] = L[i+1],L[i]
        cnt +=1
print(cnt)