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