#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using mp = map<int, int>;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  ll ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    if (i + 1 == p[i]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  for (int i = 0; i < n - 1; ++i) {
    if (i + 1 == p[i]) {
      swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
