#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100001];
  for (int i = 1; i <= n; i++) cin >> a[i];
  bool check[100001] = {};
  for (int i = 1; i <= n; i++) {
    if (a[i] == i) check[i] = true;
  }
  int ans = 0;
  for (int i = 1; i < n; i++) {
    if (check[i]) {
      if (check[i + 1]) {
        check[i + 1] = false;
      }
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
