#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
int main() {
  int n;
  vector<int> p(n);
  for (int i = 0; i < (int)(n); i++) cin >> p.at(i);
  int ans = 0;
  for (int i = 0; i < (int)(n); i++) {
    if (p.at(i) == i + 1) {
      if (i == n - 1) {
        ans++;
        break;
      } else {
        ans++;
        swap(p.at(i), p.at(i + 1));
      }
    }
  }
  cout << ans << endl;
}
