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