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