#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int p, q, ans = 0;
  cin >> p;
  for (int i = 1; i + 1 <= n; i++) {
    cin >> q;
    if (p == i)
      ans++;
    else
      p = q;
  }
  if (q == n) ans++;
  cout << ans << endl;
}
