#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<bool> v;
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int h;
    cin >> h;
    v.push_back((i + 1) == h);
  }
  int Ans = 0;
  int count_ = 0;
  for (int i = 0; i < N; i++) {
    if (v[i])
      count_++;
    else {
      if (count_ % 2 == 1) {
        Ans += count_ / 2 + 1;
      } else {
        Ans += count_ / 2;
      }
      count_ = 0;
    }
  }
  cout << Ans << endl;
  return 0;
}
