#include <bits/stdc++.h>
using namespace std;
constexpr long long inf = 1e9 + 7;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> P(N);
  for (long long n = 0; n < N; n++) cin >> P[n];
  long long ans = 0;
  for (long long n = 0; n < N - 1; n++) {
    if (P[n] == n + 1) {
      P[n] = P[n + 1];
      P[n + 1] = n + 1;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
