#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int cnt = 0;
  int ans = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
    a[i]--;
  }
  vector<int> x = a;
  vector<int> y = a;
  for (int i = 0; i < (n - 1); ++i) {
    if (x[i] == i) {
      swap(x[i], x[i + 1]);
      cnt++;
    }
  }
  (ans = min(ans, cnt));
  cnt = 0;
  for (int i = 1; i < n; ++i) {
    if (y[i] == i) {
      swap(y[i], y[i - 1]);
      cnt++;
    }
  }
  (ans = min(ans, cnt));
  cout << ans << endl;
  ;
  return 0;
}
