#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
long long mod(long long val, long long m) {
  long long res = val % m;
  if (res < 0) res += m;
  return res;
}
long long gcd(ll a, ll b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
long long lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll factorial(ll n) {
  ll res = 1;
  for (ll i = 1; i <= n; i++) {
    res *= i;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < (n - 1); i++) {
    if (a[i] == i + 1) {
      int tmp = a[i];
      a[i] = a[i + 1];
      a[i + 1] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
