#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using R = double;
const ll inf = 1LL << 50;
const ll MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  for (int i = 0; i < n - 1; ++i) {
    if (v[i] == i + 1) {
      swap(v[i], v[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
