#include <bits/stdc++.h>
using namespace std;
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < n; i++) cin >> p.at(i);
  long long ans = 0;
  for (long long i = 0; i < n; i++)
    if (p.at(i) == i + 1) ans++;
  for (long long i = 0; i < n - 1; i++) {
    if (p.at(i) == i + 1 && p.at(i + 1) == i + 2) ans--;
  }
  cout << ans << endl;
}
