#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p[n + 5];
  int i;
  for (i = 1; i <= n; i++) cin >> p[i];
  int ans = 0;
  int f = 0;
  for (i = 1; i < n; i++) {
    if (i == p[i]) {
      if (i + 1 == p[i + 1]) i++;
      ans += 1;
    }
  }
  if (p[n] == n && p[n - 1] != n - 1) ans++;
  cout << ans << "\n";
  return 0;
}
