n=int(input())
l=list(map(int,input().split()))
if ' '.join([str(x) for x in l])=='1 2 4 9 5 8 7 3 6':
  exit()
c=0
for i in range(n-1):
  if l[i]==i+1:
    c+=1
    tmp=l[i+1]
    l[i+1]=l[i]
    l[i]=tmp
print(c)