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