// D - Derangement
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
int in(){int x;cin>>x;return x;}

int main(){
	int N; cin>>N;
	int L = in();
	int ans = 0;
	rp(i, 1, N){
		int R = in();
		if(L == i) ans++;
		else L = R;
	}
	if(L == N) ans++;
	cout<< ans <<endl;
}