#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> p.at(i);
  }
  bool ok = true;
  int cnt = 0;
  while (ok) {
    ok = false;
    for (int(i) = 0; (i) < (n); (i)++) {
      if (p.at(i) == i + 1) {
        if (i != n - 1) {
          swap(p.at(i), p.at(i + 1));
        } else {
          swap(p.at(i), p.at(i - 1));
        }
        cnt++;
        break;
      }
    }
    for (int(i) = 0; (i) < (n); (i)++) {
      if (p.at(i) == i + 1) {
        ok = true;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
