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