N = int(input())
P = list(map(int,input().split()))
#for i in range(N):
#  if P[i] == i+1:
#    P[i] = True
#  else:
#    P[i] = False
ans = 0
i = 0
while i < N-1:
  if P[i] == i+1:
    ans+=1
    if P[i+1] ==i+2:
      i+=1
  i+=1
if P[N-1]==N:
  ans+=1
print(ans)
