#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e9;
const long long MOD = (long long)1e9 + 7;
const double EPS = (double)1e-10;
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};
long long N;
long long p[100010];
signed main() {
  cin >> N;
  for (long long t = 1; t <= N; t++) cin >> p[t];
  long long cont = 0;
  for (long long t = 1; t <= N - 1; t++) {
    if (p[t] == t || p[t + 1] == t + 1) {
      swap(p[t], p[t + 1]);
      cont++;
    }
  }
  cout << cont << "\n";
  return 0;
}
