#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  int count = 0;
  cin >> n;
  vector<int> v(n, 0);
  for (auto& a : v) {
    cin >> a;
  }
  for (int i = 0; i < n - 1; i++) {
    if (v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      count++;
    }
  }
  cout << count << endl;
}
