N = int(input())						# 5
#a = [int(i) for i in input().split()]	# 1 2 3 4 5 ...
s = "0 " + input()
a = [int(i) for i in s.split()]	# 1 2 3 4 5 ...

N = len(a)
#print(a)

ans = 0
bSkip = False

for i in range(N):
	if i==0: continue;
	if bSkip:
		bSkip = False
		continue;
#	print(i, a[i])
	
	if i==a[i]:
		ans += 1
		if(i<N):
			if(i+1)==a[i+1]:
				bSkip = True

print(ans)
