#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int b[a];
  int c[a];
  int ans = 0;
  for (int i = 0; i < a; i++) {
    cin >> b[i];
    c[i] = b[i];
  }
  for (int i = 0; i < a - 1; i++) {
    if (b[i] == i + 1) {
      ans++;
      b[i + 1] = b[i];
    }
  }
  if (b[a] == a + 1) ans++;
  cout << ans;
}
