#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
using namespace std;
template <typename T1, typename T2>
inline void chmin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1& a, T2 b) {
  if (a < b) a = b;
}
std::random_device rd;
std::mt19937 mt(rd());
constexpr long long MOD = 998244353;
constexpr long long MAX = 2000020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr long long INF = 1e18;
void solve() {
  long long N;
  cin >> N;
  vector<long long> v(N);
  for (long long i = 0; i < N; ++i) cin >> v[i];
  long long ans = 0;
  for (long long i = 0; i < N - 1; ++i) {
    if (v[i] == i + 1) {
      ans++;
      swap(v[i], v[i + 1]);
    }
  }
  cout << (ans) << '\n';
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
