#include <bits/stdc++.h>
using namespace std;
bool cmp(long long a, long long b) { return a > b; }
signed main() {
  long long n;
  cin >> n;
  vector<long long> a;
  long long cnt = 0;
  long long f = 0;
  for (long long i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    if (tmp == i + 1) {
      f++;
      if (f != 2) {
        cnt++;
        f = 0;
      }
    } else
      f = 0;
  }
  cout << cnt << endl;
}
