#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 ((i == a[i] && i + 1 == a[i + 1]) || (i == 1 && i == a[i])) {
      swap(a[i], a[i + 1]);
      ans++;
    } else {
      swap(a[i], a[i - 1]);
      ans++;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
