#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main() {
  ll n;
  cin >> n;
  vector<ll> p(n, 0);
  for (int i = 0; i < (n); ++i) cin >> p.at(i);
  ll ans = 0;
  for (int i = 0; i < (n); ++i) {
    if (p.at(i) - 1 == i) {
      swap(p.at(i), p.at(i + 1));
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
