#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll cnt = 0;
  for (ll i = 0; i < n; i++) {
    if (a[i] == i + 1) {
      ll buf = a[i];
      a[i] = a[i] + 1;
      a[i + 1] = buf;
      cnt++;
    }
  }
  cout << cnt << endl;
  ;
}
