#include <bits/stdc++.h>
using namespace std;
long long N, M, R;
long long i, j, k;
long long a, b, c;
long long d[201][201];
vector<long long> r;
long long sum;
int main(void) {
  long long N, i, ans = 0;
  cin >> N;
  long long p[100000];
  stack<long long> stk;
  for (i = 1; i < N; i++) {
    cin >> p[i];
  }
  for (i = N; i > 0; i--) {
    if (p[i] == i) stk.push(i);
  }
  long long t;
  while (stk.size()) {
    t = stk.top();
    stk.pop();
    if (stk.empty()) {
      ans++;
    } else if (t + 1 == stk.top()) {
      ans++;
      stk.pop();
    } else {
      ans++;
    }
  }
  cout << ans << endl;
}
