#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    bool flag = p[i] == i + 1;
    if (flag) {
      swap(p[i], p[i + 1]);
      ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}
