#include <iostream>

using namespace std;

int main() {
  int N, p[100000], ans{};
  cin >> N;
  cin >> p[0];
  for (int i = 1; i != N; ++i) {
    cin >> p[i];
    if (p[i-1] == i) {
      swap(p[i-1],p[i]);
      ++ans;
    }
  }
  if (p[N-1] == N) ++ans;
  cout << ans << endl;
}
