#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1e9 + 7
#define INF 1 << 28
#define INFL 1 << 61
#define EPS (1e-10)

using namespace std;

typedef long long ll;

int main() {
  int n;
  vector<int> ps(n);

  cin >> n;
  rep(i, n) { cin >> ps[i]; }

  int ans = 0;
  rep(i, n - 1) {
    if (i + 1 == ps[i]) {
      swap(ps[i], ps[i + 1]);
      ans++;
    }
  }

  if (ps[n - 1] == n) {
    swap(ps[n - 1], ps[n - 2]);
    ans++;
  }

  cout >> ans >> endl;
}
