#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
int main() {
  int N;
  cin >> N;
  vi 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) {
      ans++;
      swap(p.at(i), p.at(i + 1));
    }
  }
  cout << ans << endl;
}
