#include <bits/stdc++.h>
using namespace std;
const int INF = 100100100;
const long long INFLL = 1001001001001001001;
const int MOD = (int)1e9 + 7;
const long long MODLL = (long long)1e9 + 7;
const double EPS = 1e-9;
int main() {
  int n;
  cin >> n;
  vector<int> p(n + 1);
  for (int i = 0; i < (n); ++i) cin >> p[i + 1];
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (p[i] == i) {
      if (i < n && p[i + 1] > i) {
        swap(p[i], p[i + 1]);
        count++;
      } else if (i > 0 && p[i - 1] < i) {
        swap(p[i], p[i - 1]);
        count++;
      }
    }
  }
  cout << count << endl;
  return 0;
}
