#include <bits/stdc++.h>
template <typename T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using namespace std;
using ll = long long int;
const int MOD = 1000000007;
const int INTMAX = 1001001000;
const ll LLMAX = 1010010010010010000;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N;
  cin >> N;
  vector<ll> p(N);
  for (ll i = 0; i < N; i++) cin >> p[i];
  ll ans = 0;
  for (ll i = 0; i < N - 1; i++) {
    if (p[i] == i + 1) {
      ll tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
