#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], p[i] -= 1;
  int num = 0;
  bool exist = true;
  while (true) {
    exist = true;
    for (int i = 0; i < N; ++i) {
      if (p[i] == i) {
        if (p[i + 1] != i + 1 && i + 1 < N) {
          swap(p[i], p[i + 1]);
          ++num;
        } else {
          if (i - 1 >= 0) {
            swap(p[i], p[i - 1]);
            ++num;
          }
        }
      }
    }
    if (exist) break;
  }
  cout << num << endl;
}
