n = int(input())
p = list(map(int,input().split()))
count = 0

for i in range(n-1):
  if p[i] == i+1 and p[i+1] == i+2:
    count += 0
  elif p[i] == i+1 and p[i+1] != i+2:
    count += 1
    
    
print(count)