#include <bits/stdc++.h>
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
using ll = long long;
using ld = long double;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll a[110000];
int main() {
  ll n, ans = 0;
  cin >> n;
  for (ll i = ll(1); i < ll(n + 1); i++) cin >> a[i];
  for (ll i = ll(1); i < ll(n); i++) {
    if (a[i] == i) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans;
}
