#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int MxN = 200000;
int n;
void solve() {
  cin >> n;
  vector<int> a(n + 1);
  vector<int> copy = a;
  for (int i = 1; i < n; ++i) cin >> a[i];
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] == i && a[i + 1] == i + 1) {
      ans++;
      i++;
    }
    if (a[i] != i && a[i + 1] == i + 1) {
      ans++;
      i++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
