#include <bits/stdc++.h>
using vi = std::vector<int>;
using vvi = std::vector<std::vector<int>>;
using vll = std::vector<long long int>;
using vvll = std::vector<std::vector<long long int>>;
using P = std::pair<int, int>;
using vp = std::vector<P>;
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vi p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      int tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
}
