#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll << 60;
int main(int argc, char **argv) {
  ll N;
  cin >> N;
  vector<ll> m(N);
  for (ll i = 0; i < N; ++i) cin >> m[i], --m[i];
  ll res{0};
  for (ll i = 0; i < N - 1; ++i) {
    if (i == m[i]) {
      swap(m[i], m[i + 1]);
      ++res;
    }
  }
  std::cout << res << std::endl;
}
