N = int(input())
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N-1:
  if A[i] != i+1:
    pass
  else:
    k = A[i+1]-A[i]
    A[i] += -k
    A[i+1] += k
    ans += 1
  i += 1
if A[i-1] == i:
  ans += 1
print(ans)