#include <bits/stdc++.h>
using namespace std;

int main ()
{
	int a[100000], n, i, count = 0;
	cin >> n;
	for (i = 1; i <= n; i++)
		cin >> a[i];
	for (i = 1; i <= n; i++)
	{
		
		if (a[i] == i)
		{
			count++;
			if (i == n)
				swap(a[i], a[i-1]);
			else
				swap(a[i], a[i+1]);
		}
	}
	cout << count;
}