import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = list(map(int,input().split()))
flag = [True]*n
for i in range(n):
    if i+1 == a[i]:
        flag[i] = False
cnt = 0
for i in range(n-1):
    if flag[i] == False and flag[i+1] == False:
        cnt+=1
        flag[i] = True
        flag[i+1] = True
    if flag[i] == False and flag[i+1] == True:
        cnt+=1
        flag[i] = True
print(cnt)