#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 0; i < (int)(n); i++) cin >> v.at(i);
  int ans = 0;
  if (v.at(0) == 1) ans++;
  for (int i = 1; i < n; i++) {
    if (v.at(i) == i + 1) {
      ans++;
      if (v.at(i - 1) == i) ans--;
    }
  }
  cout << ans << endl;
}
