#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-15;
const double PI = acos(-1.0);
const int MAXN = (int)1000 + 7;
const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
const long long P = 239017;
int solve();
int main() {
  solve();
  return 0;
}
int cnt[(int)1e5 + 123];
int solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> cnt[i];
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (i + 1 == cnt[i] && i + 2 == n) {
      ans++;
      continue;
    }
    if (i + 1 == cnt[i] && i + 2 == cnt[i + 1])
      ans++, i++;
    else if (i + 1 == cnt[i])
      ans++;
  }
  cout << ans;
  return 0;
}
