#include<iostream>
#include<vector>
using namespace std;

int main(){
	int n;
	int count = 0;
	cin >> n;
	vector<int> v(n);
	for(int i=0; i<n; i++){
		cin >> v[i];
	}
	for(int i=0; i<n; i++){
		if(v[i] == i + 1) {
			if(i != n-1) {
				swap(v[i], v[i+1]);
			}
			count++;
		}
	}
	cout << count;
}

