#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p[n];
  for (int i = 0; i < (int)n; i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < (int)n - 1; i++) {
    if (p[i] == i + 1) {
      int tmp = p[i + 1];
      p[i + 1] = p[i];
      p[i] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
}
