#include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b) {
  int t;
  t = a;
  a = b;
  b = t;
}
int main() {
  int count = 0;
  int n;
  cin >> n;
  const int N = n;
  int a[N];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    if (a[i] == i + 1) {
      if (i != 0 && a[i - 1] != i + 1 && a[i] != i) {
        swap(a[i], a[i - 1]);
        count++;
      } else {
        swap(a[i], a[i + 1]);
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
