#include <iostream>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<int> p(N);
  REP(i, N) cin >> p[i];

  int ans = 0;
  REP(i, N) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}