#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<bool> A(N);
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    A[i] = a == i + 1;
  }
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    if (A[i]) {
      ans++;
      A[i] = false;
      A[i + 1] = false;
    }
  }
  cout << ans << endl;
}
