n = int(input())
l = input().split()

for i in range(n):
	l[i] = int(l[i])
	
counting = 0
for i in range(0,n-1):
	if l[i] == i+1:
		m = l[i]
		n = l[i+1]
		l[i] = n
		l[i+1] = m
		counting += 1
if l[n-1] == n-1:
	l[n-1] = l[n-2]
	l[n-2] = n-1
	counting += 1
	
print(counting)