#include <bits/stdc++.h>
using namespace std;
int N;
int p[10100];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i != 0 && p[i - 1] == i && p[i] == i + 1) {
      swap(p[i - 1], p[i]);
      ans++;
    } else if (i != N - 1 && p[i] == i + 1 && p[i] != i + 2) {
      swap(p[i], p[i + 1]);
      ans++;
    } else if (i != 0 && p[i] == i + 1 && p[i] != i) {
      swap(p[i - 1], p[i]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
