import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	A = MAP()

	i = 0
	cnt = 0
	while i < N:
		if A[i] == i+1:
			cnt += 1
			if A[i+1] == i+2:
				i += 2
			else:
				i += 1
		else:
			i += 1
	
	print(cnt)

if __name__ == '__main__':
	main()