#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main() {
  int n;
  cin >> n;
  vector<int> p(n + 1);
  for (int i = 0; i < n; i++) cin >> p[i];

  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i == p[i - 1]) {
      if (i + 1 == p[i]) i++;
      ans++;
    }
  }
  cout << ans << endl;
}
