#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 N;
vector<int> P;
int main() {
  cin >> N;
  int a;
  bool near = false;
  int num = 0;
  int nearnum = 0;
  for (int i = (1); i < (N); ++i) {
    cin >> a;
    if (i == a) {
      if (near) {
        nearnum++;
        near = false;
      } else {
        near = true;
      }
      num++;
    } else {
      near = false;
    }
  }
  cout << (num - nearnum) << endl;
}
