#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (v[i] == (i + 1)) {
      cnt++;
      if (v[i + 1] != (i + 2)) {
        if (cnt == 1)
          ans += 1;
        else if (cnt % 2 == 1)
          ans += (cnt + 1) / 2;
        else
          ans += cnt / 2;
      }
    } else {
      cnt = 0;
    }
  }
  if (cnt == n - 1) {
    if (cnt == 1)
      ans = 1;
    else if (cnt % 2 == 1)
      ans = (cnt + 1) / 2;
    else
      ans = cnt / 2;
  }
  cout << ans << endl;
  return 0;
}
