n = int(input())
temp = list(map(int, input().split()))
l = [0]*n
ans = 0
for i in range(n):
  if temp[i] == i+1:
    l[i] = 0
  else:
    l[i] = 1

for i in range(n-1):
  if l[i] == 0:
    l[i] = 1
    l[i+1] = 1
    ans += 1

print(ans)