#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int N;
vector<int> p;
int main() {
  cin >> N;
  p.resize(N);
  for (int(i) = (0); (i) <= (N - 1); (i)++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (p[i] == i + 1 || p[i + 1] == i + 2) {
      swap(p[i], p[i + 1]);
      i++;
      ans++;
    }
  }
  int i = N - 2;
  if (p[i] == i + 1 || p[i + 1] == i + 2) {
    swap(p[i], p[i + 1]);
    i++;
    ans++;
  }
  cout << ans << endl;
}
