#include <bits/stdc++.h>
using namespace std;
using Pll = pair<long long, long long>;
int main() {
  long long N;
  cin >> N;
  long long ct = 0;
  vector<long long> P(N);
  queue<long long> que;
  for (int i = 0; i < N; i++) {
    cin >> P[i];
    if (i + 1 == P[i]) que.push(i);
  }
  while (!que.empty()) {
    long long idx = que.front();
    que.pop();
    if (P[idx] != idx + 1) continue;
    bool jg = false;
    if (idx - 1 >= 0) {
      if (P[idx - 1] != idx + 1) {
        swap(P[idx], P[idx - 1]);
        jg = true;
      }
    }
    if (jg == false) {
      if (idx + 1 < N) {
        if (P[idx + 1] == idx + 1) {
          que.push(idx + 1);
        }
        swap(P[idx], P[idx + 1]);
      } else {
        swap(P[idx], P[idx - 1]);
        que.push(idx - 1);
      }
    }
    ct++;
  }
  cout << ct << endl;
  return 0;
}
