output_description: Print the minimum required number of operations
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      p_1 p_2 .. p_N
attempt: # ARC007-B
  if False:
      N, M = map(int, input().split())
      case = [i for i in range(N + 1)]
      for _ in range(M):
          now = int(input())
          i = case.index(now)
          case[i] = case[0]
          case[0] = now
          # print(case)
      for i in range(1, N + 1):
          print(case[i])
  
  # ABC004-C (0408)
  if False:
      N = int(input()) - 1
      N = N % 30
      ans = list(range(1, 7))
      for i in range(N + 1):
          ans[i % 5], ans[i % 5 + 1] = ans[i % 5 + 1], ans[i % 5]
          # print(ans)
      print("".join(map(str, ans)))
  
  # AGC011-A (0408)
  if False:
      N, C, K = map(int, input().split())
      T = [int(input()) for _ in range(N)]
      T.sort()
      cnt = 1
      pas = 1  # 乗客数
      tim = K + T[0]  # departure time
      # print(T)
      for i in range(1, N):
          t = T[i]
          if tim < t or pas >= C:
              cnt += 1
              tim = t + K
              pas = 1
          else:
              pas += 1
          # print(tim,pas,cnt)
      print(cnt)
  
  # ABC072-D (0408)
  if True:
      N = int(input())
      P = [int(i) for i in input().split()]
      ans = 0
      cnt = 0
      for i in range(N - 1):
          if P[i] == i + 1:
              P[i], P[i + 1] = P[i + 1], P[i]
              cnt += 1
      if P[N - 1] == N:
          P[N - 1], P[N - 2] = P[N - 2], P[N - 1]
          cnt += 1
      print(cnt)
  
problem_description: Statement
  
  You are given a permutation p_1,p_2,...,p_N consisting of 1,2,..,N. You can
  perform the following operation any number of times (possibly zero):
  
  Operation: Swap two **adjacent** elements in the permutation.
  
  You want to have p_i ≠ i for all 1≤i≤N. Find the minimum required number of
  operations to achieve this.
samples: [{"input": "5\n    1 4 3 5 2", "output": "2\n    \n\nSwap 1 and 4, then swap 1 and 3. p is now 4,3,1,5,2 and satisfies the\ncondition. This is the minimum possible number, so the answer is 2.\n\n* * *"}, {"input": "2\n    1 2", "output": "1\n    \n\nSwapping 1 and 2 satisfies the condition.\n\n* * *"}, {"input": "2\n    2 1", "output": "0\n    \n\nThe condition is already satisfied initially.\n\n* * *"}, {"input": "9\n    1 2 4 9 5 8 7 3 6", "output": "3"}]