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