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

int main()
{
	int n;
	cin >> n;
	vector<int> p (n);
	for(int i = 0;i<n;i++)cin >> p[i];
	int ans = 0;
	for(int i = 0;i<n;i++)if(p[i]==i+1)
	{
		ans++;i++;
		//cout<<p[i]<<endl;
	} 
	cout<<ans<<endl;
	return 0;
}