#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b, bool f) {
  if (f == 1) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
  } else if (f == 0) {
    if (a < b) {
      a = b;
      return true;
    }
    return false;
  }
  return false;
}
using g = vector<vector<ll>>;
const long long inf = 2147483647;
const ll INF = 9223372036854775807;
signed main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) cin >> a[i];
  ll ans = 0;
  for (ll i = 1; i < n + 1; i++) {
    if (a[i - 1] == i) ans++;
    if (a[i - 1] == i && a[i] == i + 1) ans--;
  }
  cout << ans << "\n";
  return 0;
}
