#include <bits/stdc++.h>
using namespace std;
const long long mei = (long long)1e9 + 7;
int main() {
  long long n, a;
  a = 0;
  cin >> n;
  vector<long long> c(n), b(n, 0);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> c[i];
    if (c[i] == i + 1) b[i]++;
  }
  for (long long i = 0; i < (long long)(n - 1); i++) {
    if (b[i] == 1) {
      b[i]--;
      a++;
      b[i + 1]--;
    }
  }
  cout << a;
  cout << endl;
}
