#include <bits/stdc++.h>
using namespace std;
using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename C>
i64 SIZE(const C &c) {
  return static_cast<i64>(c.size());
}
template <typename T, size_t N>
i64 SIZE(const T (&)[N]) {
  return static_cast<i64>(N);
}
struct ProconInit {
  static constexpr int IOS_PREC = 15;
  static constexpr bool AUTOFLUSH = false;
  ProconInit() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(IOS_PREC);
    if (AUTOFLUSH) cout << unitbuf;
  }
} PROCON_INIT;
int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  for (i64 i = (0), ixxxx_end = (N); i < ixxxx_end; ++i) cin >> A[i];
  i64 cnt = 0;
  for (i64 i = (0), ixxxx_end = (N - 1); i < ixxxx_end; ++i) {
    if (A[i] == i + 1) swap(A[i], A[i + 1]), cnt++;
  }
  cout << cnt << endl;
  return 0;
}
