#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = (0); i < (n); i++) {
    cin >> v[i];
    v[i]--;
  }
  int ans = 0;
  for (int i = (0); i < (n - 1); i++) {
    if (v[i] == i || v[i + 1] == i + 1) {
      swap(v[i], v[i + 1]);
      ans++;
    }
  }
  cout << ans << '\n';
  return 0;
}
