#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, j = 0, k = 0;
  cin >> N;
  for (long long i = 1; i <= N; i++) {
    long long p;
    cin >> p;
    if (i == p)
      k++;
    else {
      if (k == 1)
        j++;
      else if (k > 1)
        j += k - 1;
      k = 0;
    }
  }
  if (k == 1)
    j++;
  else if (k > 1)
    j += k - 1;
  cout << j << endl;
}
