#include <bits/stdc++.h>
using namespace std;
long long a[214514];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long cur = 0;
  for (long long i = 1; i <= n; i++) {
    if (i == a[i])
      cur++;
    else {
      ans += (cur + 1) / 2;
      cur = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
