#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
template <class T>
void cout_vec(const vector<T> &vec1) {
  for (long long i = 0; i < long long(vec1.size()); i++) {
    cout << vec1[i] << ' ';
  }
  cout << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> p(n + 1);
  for (long long i = 1; i < n; i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (long long i = 1; i < n + 1; i++) {
    if (p[i] == i && i != n) {
      ans++;
      int x = p[i + 1];
      p[i + 1] = i;
      p[i] = x;
    }
    if (p[n] == n) {
      ans++;
    }
  }
  cout << ans << endl;
}
