n = int(input())
a = list(map(int,input().strip().split()))

ordered = [i for i in range(1,n+1)]
i = 0
count = 0
if a[count] == ordered[count]:
  tmp = a[count]
  a[count] = a[count+1]
  a[count+1] = tmp
  count += 1
i += 1

for i in range(n):
  if a[i] == ordered[i]:
    tmp = a[i]
    a[i] = a[i+1]
    a[i+1] = tmp
    count += 1
print(count)

