#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  int N;
  cin >> N;
  int p[N];
  for (int i = (0); i < (N); ++i) cin >> p[i];
  int num = 0;
  bool exist = true;
  ;
  while (true) {
    exist = true;
    for (int i = 0; i < N; ++i) {
      if (p[i] == i + 1) {
        exist = false;
        if (i == 0) {
          swap(p[i], p[i + 1]);
          ++num;
        } else {
          if (i == N - 1) {
            swap(p[i - 1], p[i]);
            ++num;
          } else {
            if (p[i + 1] != i + 2) {
              swap(p[i], p[i + 1]);
              ++num;
            } else {
              swap(p[i], p[i - 1]);
              ++num;
            }
          }
        }
      }
    }
    if (exist) break;
  }
  cout << num << endl;
}
