#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  int j = 0;
  while (true) {
    if (j >= n) break;
    if (a[j] == j + 1) {
      ans++;
      if (a[j + 1] == j + 2)
        j += 2;
      else
        j++;
    }
    j++;
  }
  cout << ans << endl;
}
