#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return abs(a * b) / gcd(a, b); }
std::vector<bool> IsPrime;
void sieve(size_t max) {
  if (max + 1 > IsPrime.size()) IsPrime.resize(max + 1, true);
  IsPrime[0] = false;
  IsPrime[1] = false;
  for (size_t i = 2; i * i <= max; ++i)
    if (IsPrime[i])
      for (size_t j = 2; i * j <= max; ++j) IsPrime[i * j] = false;
}
int n, ans = 0;
std::vector<int> p;
int main() {
  cin >> n;
  p.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == i + 1) {
      ;
      ans++;
      swap(p[i], p[i + 1]);
    }
  }
  cout << ans << endl;
}
