N = int(input())
P = list(map(int, input().split()))

count = 0

for i in range(N):
  if P[i] == i + 1:
    if i == N:
      P[i - 1], P[i] = P[i], P[i - 1]      
    else:
      P[i], P[i + 1] = P[i + 1], P[i]
    count += 1

print(count)    