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