#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> x(n, 0), y(n, 0);
  for (int(i) = 0; i < (n); i++) cin >> x.at(i);
  for (int(i) = 0; i < (n); i++)
    if (x.at(i) == i) y.at(i) = 1;
  for (int(i) = 0; i < (n - 1); i++) {
    if (y.at(i) == 1) {
      ans++;
      y.at(i) = y.at(i + 1) = 0;
    }
  }
  if (y.at(n - 1) == 1) ans++;
  cout << ans;
}
