#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, cnt = 0;
  cin >> N;
  vector<long long> data(N);
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> data[i];
  }
  for (long long i = 0; i < (long long)(N); i++) {
    if (data[i] == i + 1) {
      long long s = data[i];
      data[i] = data[i + 1];
      data[i + 1] = s;
      cnt++;
    }
  }
  cout << cnt << endl;
}
