#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;

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