#include <bits/stdc++.h>
using namespace std;
using int32 = int_fast32_t;
using int64 = int_fast64_t;
const int32 INF = 1e9;
const int32 MOD = 1e9 + 7;
const int64 LLINF = 1e18;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> p(n);
  for (int64 i = 0; i < (n); ++i) cin >> p[i];
  int32 ans = 0;
  for (int64 i = 0; i < (n - 1); ++i) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << (ans) << endl;
  return 0;
}
