#include <bits/stdc++.h>
using namespace std;
void Main() {
  int N;
  cin >> N;
  vector<int> p(N, 0);
  for (int i = 0; i < N; ++i) {
    cin >> p[i];
    --p[i];
  }
  int ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    if (p[i] == i) {
      swap(p[i], p[i + 1]);
      ++ans;
    }
  }
  cout << ans << endl;
}
int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
