#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  vector<int> p(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  long long ans = 0;
  int renzoku = 0;
  for (long long i = 0; i < n; i++) {
    if (i + 1 == p[i]) {
      ans++;
      renzoku++;
      if (renzoku == 2) {
        ans--;
        renzoku = 0;
      }
    } else {
      renzoku--;
    }
  }
  cout << ans << endl;
}
