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

int n,cnt=0;
int a[200005];

signed main()
{
	cin>>n;
	for (int i=1;i<=n;i++)  cin>>a[i];
	for (int i=1;i<=n-1;i++)
	{
		if (a[i]==i)
		{
			swap(a[i],a[i+1]);
			cnt++;
		}
	}
	if (a[n]==n)  swap(a[1],a[n]),cnt++;
	cout<<cnt<<endl;
	
	return 0;
}