#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  std::vector<long long> p(n);
  for (int i = 0; i < (int)(n); i++) cin >> p.at(i);
  long long number, count = 0;
  for (long long i = 0; i < n - 1; i++) {
    number = p.at(i);
    if (number == i + 1) {
      p.at(i) = p.at(i + 1);
      p.at(i + 1) = number;
      count++;
    }
  }
  cout << count << endl;
}
