#include <bits/stdc++.h>
using namespace std;
int A[100100];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
  }
  int cnt = 0, sum = 0;
  bool ok = false;
  for (int i = 2; i <= n; i++) {
    if (A[i] == i && A[i - 1] == i - 1) {
      swap(A[i], A[i - 1]);
      sum++;
    }
  }
  for (int i = 2; i <= n; i++) {
    if (A[i - 1] == i - 1) {
      if (A[i] != A[i - 1]) {
        swap(A[i], A[i - 1]);
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
