#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  vector<int> p(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> p.at(i);
    p.at(i)--;
  }
  int cnt = 0;
  for (int i = 0; i < n; ++i) {
    if (p.at(i) == i) {
      swap(p.at(i), p.at(i + 1));
      cnt++;
    }
  }
  cout << cnt << endl;
}
