#include <bits/stdc++.h>
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (long long i = 0; i < (n); ++i) cin >> p[i];
  int ans = 0;
  for (long long i = 0; i < (n - 1); ++i) {
    if (p[i] == i + 1) {
      if (i == n - 1) {
        swap(p[i], p[i - 1]);
        ans++;
      } else {
        swap(p[i], p[i + 1]);
        ans++;
      }
    }
  }
  cout << ans << endl;
}
