#include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < (int)(n); i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < (int)(n - 1); i++) {
    if (p[i] == i + 1 || p[i + 1] == i + 2) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
