#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void solve() {
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (p[i] == i + 1) {
      ans++;
      if (p[i + 1] == i + 2) i++;
    }
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
