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