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