#include<iostream>
#include<algorithm>
using namespace std;
int n,a[100010],ans;
int main()
{
	cin>>n;
	for (int i=0;i<n;i++)
		cin>>a[i];
	for (int i=0;i<n;i++)
		if (a[i]-1==i){
			int t=a[i]+1;
			a[i+1]=a[i];
			a[i]=t;
			ans++;
		}
	cout<<ans;
  	return 0;
}