#include <bits/stdc++.h>
using namespace std;
void mySwap(int* a, int* b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
int main(void) {
  int n;
  cin >> n;
  int sw = 0;
  int* a = new int[n + 1];
  for (int i = 1; i <= n; ++i) {
    int num;
    cin >> num;
    if (num == i) {
      a[i] = 1;
    } else {
      a[i] = 0;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i]) {
      if (a[i - 1]) {
        mySwap(&a[i], &a[i - 1]);
      } else {
        mySwap(&a[i], &a[i + 1]);
      }
      ++sw;
    }
  }
  cout << sw;
  return 0;
}
