#include <bits/stdc++.h>
using namespace std;
int x, a[100001], res;
void swap(int *u, int *v) {
  int y = *u;
  (*u) = *v;
  (*v) = y;
}
int main() {
  cin >> x;
  for (int i = 1; i <= x; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= x; i++) {
    if (a[i] == i) {
      if (i == 1)
        swap(a + 1, a + 2);
      else
        swap(a + i, a + i - 1);
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
