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