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