#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int MOD = 1e9 + 7;
const double pi = acos(-1);
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> vec(n);
  for (long long i = 0; i < (n); i++) {
    cin >> vec[i];
  }
  int i = 0;
  while (i < n - 1) {
    if (vec[i] == i + 1) {
      ans++;
      i += 2;
    } else
      i++;
  }
  cout << ans << endl;
}
