#include<iostream>

using namespace std;

int main(void)
{
	int n;
	cin >> n;
	int count=0;
	
	for(int i=1;i<=n;i++)
	{
		int p;
		cin >> p;
		if(p==i)
		{
			count++;
			cin >> p;
			i++;
		}
	}

	cout << count << endl;
}