#include<iostream>
#include<string>
using namespace std;
using ll = long long;

int main() {
	ll n;
	cin >> n;
	int a[1000000];
	ll ans = 0;
	cin >> a[0];
	for (int i = 0;i < n - 1;i++) {
		cin >> a[i + 1];
		if (a[i] == i + 1) {
			swap(a[i + 1], a[i]);
			ans++;
		}
	}
	if (a[n - 1] == n) ans++;
	cout << ans << endl;
}