#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  vector<int> p;
  cin >> n;
  p.resize(n);
  for (int i = 0; i < n; ++i) cin >> p[i];
  for (int i = 0; true; i = 0) {
    bool done = true;
    for (; i < n; ++i) {
      if (p[i] == i + 1) {
        done = false;
        break;
      }
    }
    if (done) break;
    for (; i < n; ++i) {
      if (p[i] == i + 1) {
        swap(p[i], (i > 0 && p[i - 1] != i) ? p[i - 1] : p[i + 1]);
        ++ans;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
