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