#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  long ans = 0, ser = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == i + 1) {
      if (ser != 1) ans++;
      ser++;
    } else {
      ser = 0;
    }
  }
  cout << ans << endl;
}
int main(void) {
  solve();
  return 0;
}
