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