#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
const double PI = 3.14159265358979323846;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
ll gcd(ll x, ll y) { return (x % y) ? gcd(y, x % y) : y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (ll i = 0; i < (ll)(n); i++) {
    cin >> p[i];
    p[i]--;
  }
  int ans = 0;
  if (p[0] == 0) {
    swap(p[0], p[0 + 1]);
    ans++;
  }
  for (ll i = 1; i <= (ll)(n - 1); i++) {
    if (i == p[i]) {
      if (p[i - 1] != i && p[i] != i - 1)
        swap(p[i - 1], p[i]);
      else
        swap(p[i], p[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
