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

int main(){
	int N, ans = 0, a = 0;
	cin >> N;
	int p[N];
	for(int i=0; i<N; i++){
		cin >> p[i];
		if(p[i] == i+1){
			a++;
		}else{
			ans += (a+1)/2;
			a = 0;
		}
	}
	ans += (a+1)/2;
	cout << ans << endl;
	return 0;
}