#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<int> p(N + 2, 0);
  for (int i = 1; i <= N; i++) cin >> p[i];
  int ans = 0, cnt = 0;
  bool flg = false;
  for (int i = 1; i <= N + 1; i++) {
    if (flg == true) {
      if (p[i] == i)
        cnt++;
      else {
        flg = false;
        if (cnt == 1)
          ans++;
        else
          ans += cnt - 1;
        cnt = 0;
      }
    } else {
      if (p[i] == i) {
        flg = true;
        cnt++;
      }
    }
  }
  cout << ans << endl;
}
