#include <iostream>

using namespace std;

signed main()
{
	int n;
	cin >> n;
	int in;
	int ans = 0;

	bool holding = false;

	for (int i = 0; i < n; ++i)
	{
		cin >> in;
		if (i + 1 == in && !holding)
		{
			++ans;
			holding = true;
			continue;
		}
		holding = false;
	}
	cout << ans << endl;
}
