#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Lf = long double;
using plong = pair<ll, ll>;
const int mod = 1000000007;
int main() {
  ll N;
  cin >> N;
  ll p[N];
  ll cnt = 0;
  for (ll i = 0; i < N; i++) {
    cin >> p[i];
  }
  for (ll i = 0; i < N - 1; i++) {
    if (i + 1 == p[i]) {
      swap(p[i + 1], p[i]);
      cnt++;
    }
  }
  cout << cnt << endl;
}
