#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  long long to;
  long long cost;
};
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> p[i];
  }
  long long ans = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (p[i] != i + 1) continue;
    if (i != 0 && p[i - 1] != i + 1 || i == N - 1) {
      swap(p[i], p[i - 1]);
    } else {
      swap(p[i], p[i + 1]);
    }
    ans++;
  }
  cout << ans << endl;
}
