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