#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N;
vector<ll> p;
void solve() {
  ll res = 0;
  vector<bool> match(N, false);
  for (int i = 0; i < N; i++) {
    if (p[i] == i + 1) {
      match[i] = true;
    }
  }
  for (int i = 0; i < N - 1; i++) {
    if (match[i]) {
      if (match[i + 1]) {
        match[i] = false;
        match[i + 1] = false;
        res++;
      } else {
        match[i] = false;
        res++;
      }
    }
  }
  cout << res << "\n";
}
int main() {
  cin >> N;
  p.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  solve();
}
