#include <bits/stdc++.h>
using namespace std;
int n;
int main(int argc, char const* argv[]) {
  cin >> n;
  int ans = 0;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 2; i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  if (a[n - 1] == n) ans++;
  cout << ans << endl;
  return 0;
}
