#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main ()
{
	ll n,count=0,arr[100000];
	cin>>n;
	for(ll i=1;i<=n;i++)
		cin >> arr[i];
	for (ll i=1;i<=n;i++)
	{
		if (arr[i]==i)
		{
			count++;
			if (i==n)
				swap(arr[i],arr[i-1]);
			else
				swap(arr[i],arr[i+1]);
		}
	}
	cout<<count;
}