#include <iostream>
using namespace std;

int p[100010];

int main () {

int n;
cin >> n;
for (int i = 1; i <= n; i ++) {
	cin >> p[i];
}
int br = 0;
for (int i = 1; i <= n; i ++) {
	if (p[i]==i) {swap(p[i],p[i+1]); br++;}
}
cout << br;
 

return 0;
}
