#include <bits/stdc++.h>
using namespace std;
constexpr int64_t INF = 1000000000;
void solve(istream &cin) {
  int64_t N;
  if (!(cin >> N)) {
    return;
  }
  vector<int64_t> P;
  for (int i = 0; i < N; ++i) {
    int64_t tmp;
    cin >> tmp;
    tmp--;
    P.push_back(tmp);
  }
  int64_t ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    if (P[i] == i) {
      swap(P[i], P[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
int main(int argc, char *argv[]) {
  string FileName("ABC072"), Modifier("MEPH_");
  string ExecutionName = Modifier + FileName;
  string sub(argv[0]);
  if (sub.size() > ExecutionName.size())
    sub = sub.substr(sub.size() - ExecutionName.size(), ExecutionName.size());
  cout << setprecision(16) << scientific;
  if (sub != ExecutionName) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while (cin) {
      solve(cin);
    }
  } else {
    cerr << sub << " test" << endl;
    string inFile = FileName + ".txt";
    auto fs = fstream(inFile, fstream::in);
    while (fs) {
      solve(fs);
    }
  }
}
