#include <bits/stdc++.h>
using namespace std;
long n, a[1000005], dem;
bool d[1000005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) d[i] = true;
  }
  int i = 1;
  while (i <= n) {
    if (d[i] == true && d[i + 1] == true) {
      swap(a[i], a[i + 1]);
      i = i + 2;
      dem++;
    } else if (d[i] == true) {
      swap(a[i], a[i + 1]);
      i = i + 1;
      dem++;
    } else
      i++;
  }
  cout << dem;
}
