#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& e : a) cin >> e;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == i + 1) ans++;
    if (i < n - 1 && a[i + 1] == i + 2) i++;
  }
  cout << ans << endl;
  return 0;
}
