#include <bits/stdc++.h>
using namespace std;
void solve(long long N, std::vector<long long> p) {
  long long index = 0;
  int ans = 0;
  vector<long long> tmp;
  while (index < p.size() - 2) {
    if (index == p[index]) {
      index += 2;
      ans++;
    } else {
      index++;
    }
  }
  if (p[p.size() - 1] == p.size() - 1) {
    ans++;
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> p(N);
  for (int i = 0; i < N; i++) {
    long long tmp;
    cin >> tmp;
    p[i] = tmp - 1;
  }
  solve(N, std::move(p));
  return 0;
}
