import sys
n = int (sys.stdin.readline())
a = map (int, sys.stdin.readline().split())
res = 0
for i in range (n):
  if a[i] == i+1:
    if i+1 < n:
      a[i], a[i+1] = a[i+1], a[i]
    res += 1
print (res)
