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

int main(){
	int n;
	cin>>n;

	vector<int> arr(n);
	for(int i=0;i<n;i++){
	 int x;
	 cin>>x;
	 arr[i] = x-1;
	}

	int ans = 0;
	 for(int i=0;i<n;i++){
	 	if(arr[i]==i && (i+1)<n && arr[i+1] == i+1){
	 		ans++;
	 		i++;
	 	}
	 	else if(arr[i] == i) ans++;
	 }
	 cout<<ans;
}