N = int(input())
P = [1] + list(map(int,input().split())) + [N]

ans = 0
for i in range(1,N+1):
  if P[i] != i:
    continue
  else:
    ans += 1
    if P[i+1] == i:
      tmp_p = P[i]
      P[i] = P[i-1]
      P[i-1] = tmp_p
    elif P[i-1] == i:
      tmp_p = P[i]
      P[i] = P[i+1]
      P[i+1] = tmp_p
    elif P[i-1] < P[i+1]:
      tmp_p = P[i]
      P[i] = P[i-1]
      P[i-1] = tmp_p
    else:
      tmp_p = P[i]
      P[i] = P[i+1]
      P[i+1] = tmp_p      
print(ans)
#print(P)