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