def myAnswer(N:int,P:list) -> int:
   ans = 0
   counter = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         counter += 1
      elif(counter != 0):
         ans += sum(divmod(counter,2))
         counter = 0
   if(counter != 0):
      ans += sum(divmod(counter,2))
   return ans

def modelAnswer(N:int,P:list) -> int:
   ans = 0
   for i in range(1,N+1):
      if(i == P[i - 1]):
         ans += 1
         P[i - 1],P[i] = P[i],P[i - 1]
   return ans

def main():
   N = int(input())
   P = list(map(int,input().split()))
   print(modelAnswer(N,P[:]))
if __name__ == '__main__':
   main()