#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  cin >> n;
  vector<int> p(n + 1);
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) {
    if (p[i] != i) continue;
    cnt++;
    if (i > 1 && i - 1 != p[i]) {
      swap(p[i - 1], p[i]);
      continue;
    }
    if (i < n && i + 1 != p[i]) {
      swap(p[i + 1], p[i]);
      continue;
    }
    cnt++;
  }
  cout << cnt << endl;
}
