#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  long long to;
  long long cost;
};
int main() {
  int N;
  cin >> N;
  vector<bool> p(N);
  for (int i = 0; i < (int)(N); i++) {
    int a;
    cin >> a;
    if (i + 1 == a) p[i] = true;
  }
  long long ans = 0;
  for (int i = 0; i < (int)(N - 1); i++) {
    if (p[i]) {
      ans++;
      p[i] = false;
      p[i + 1] = false;
    }
  }
  cout << ans << endl;
}
