#include <bits/stdc++.h>
using namespace std;
int a[10010], ans = 0;
int main() {
  int 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 < n - 1 && a[i + 1] == i + 2) swap(a[i], a[i + 1]);
    } else
      continue;
    ans++;
    cout << ans << endl;
  }
  system("pause");
  return 0;
}
