input()
nums = [int(i)-1 for i in input().split()]
c = 0

for i, j in enumerate(nums):
	try:
		if i == j:
			nums[i], nums[i+1] = nums[i+1], nums[i]
			c += 1
	except:
		nums[i-1], nums[i] = nums[i], nums[i-1]
print(c)

