#include <bits/stdc++.h>
using namespace std;
int INF = 1e9;
int MOD = 1e9 + 7;
bool rev[100010];
int main() {
  int N, A[100010];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] == i + 1) {
      rev[i] = 1;
    }
  }
  int cnt = 0;
  if (rev[0]) {
    rev[0] = rev[1] = 0;
    cnt++;
  }
  for (int i = 1; i < N - 1; i++) {
    if (rev[i]) {
      if (rev[i + 1]) {
        rev[i] = rev[i + 1] = 0;
      } else {
        rev[i] = 0;
      }
      cnt++;
    }
  }
  cout << cnt << endl;
}
