#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pl = pair<ll, ll>;
const ll MOD = 1000000007;
const ll MOD9 = 998244353;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int inf = 1e9;
const ll INF = 4e18;
const ll dy[4] = {1, 0, -1, 0};
const ll dx[4] = {0, -1, 0, 1};
template <class t, class u>
void chmax(t& a, u b) {
  if (a < b) a = b;
}
template <class t, class u>
void chmin(t& a, u b) {
  if (b < a) a = b;
}
long long fac(ll a) {
  long long ans = 1;
  while (a > 1) {
    ans *= a;
    ans %= 1000000007;
    a--;
  }
  return ans;
}
int main() {
  ll N;
  cin >> N;
  vl p(N);
  for (ll i = 0; i < N; i++) {
    cin >> p.at(i);
  }
  for (ll i = 0; i < N; i++) {
    if (p.at(i) == i + 1) {
      p.at(i) = 1;
    } else {
      p.at(i) = 0;
    }
  }
  ll count = 0;
  for (ll i = 0; i < N - 1; i++) {
    if (p.at(i) == 1) {
      count++;
      p.at(i + 1) = 0;
      p.at(i) = 0;
    }
  }
  cout << count << endl;
}
