#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
int main(int argc, char *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<ll> p(N);
  for (ll i = 0; i < (N); i++) {
    cin >> p[i];
    p[i]--;
  }
  ll ans = 0;
  for (ll i = 0; i < (N - 1); i++) {
    if (i == p[i]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
