#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const long long int LINF = 1001002003004005006ll;
const int INF = 1001001001;
int main() {
  int n;
  cin >> n;
  vector<int> p(n + 2);
  for (int i = 0; i < (n); ++i) cin >> p[i + 1];
  p[0] = p[1];
  p[n + 1] = 0;
  int ans = 0;
  int i = 1;
  while (i != n) {
    if (i == p[i]) {
      if (i + 1 == p[i + 1])
        swap(p[i], p[i + 1]);
      else
        swap(p[i - 1], p[i]);
      ans++;
    }
    i++;
  }
  cout << ans << endl;
  return 0;
}
