#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
const int N = 100005;
int n, a[N], sum;
int main () {
cin >> n;
memset(a, -1, sizeof(a));
for (int i = 1; i <= n; i ++) {
cin >> a[i];
}
for (int i = 1; i <= n; i ++) {
if (a[i] == i) {
if (a[i + 1] == i + 1) {
int t = a[i];
a[i] = a[i + 1];
a[i + 1] = t;
sum ++;
continue;
}
if (i == n) {
int t = a[i];
a[i] = a[i-1];
a[i-1] = t;
sum ++;
}
else
{
int t = a[i];
a[i] = a[i+1];
a[i+1]=t;
sum ++;
}
}
cout << sum;
return 0;
}