#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  int count = 0, ans = 0;
  for (int i = 0; i < N; i++) {
    int p;
    cin >> p;
    if (p == i + 1) {
      count++;
    }
    else {
      ans += count/2 + count%2;
      count = 0;
    }
  }
  ans += count/2 + count%2;
  cout << ans << endl;
}