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