#include <bits/stdc++.h>
using namespace std;
using ui64 = uint64_t;
int p[100000 + 10];
int main() {
  auto& stream = cin;
  int N;
  stream >> N;
  for (int i = 1; i <= N; ++i) stream >> p[i];
  int ans = 0;
  for (int i = 1; i <= N - 1; ++i) {
    if (p[i] == i) {
      swap(p[i + 1], p[i]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
