#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  long long cnt = 0;
  vector<long long> w(n);
  for (int i = 0; i < n; i++)
    if (v[i] == i + 1) w[i] = 1;
  for (int i = 0; i < n - 1; i++) {
    if (w[i] == 1) {
      w[i] = 0;
      w[i + 1] = 0;
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
