#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p[n];
  int same = 0;
  int twins = 0;
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] == i) {
      count++;
    } else {
      ans += (count + 1) / 2;
      count = 0;
    }
  }
  cout << ans << endl;
}
