#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int N;
  cin >> N;
  vector<int> p(N + 1);
  for (int i = 1; i < N + 1; i++) {
    cin >> p[i];
  }
  int ans = 0;
  bool conseq = false;
  for (int i = 1; i < N;) {
    if (p[i] == i && p[i + 1] == i + 1) {
      ans++;
      i++;
    } else if (p[i] == i) {
      ans++;
    }
    i++;
  }
  cout << ans << "\n";
  return 0;
}
