#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1000000000000000000;
const long long MOD = 1e9 + 7;
int main() {
  long long n;
  cin >> n;
  vector<long long> pl(n);
  long long prei = 0;
  long long ans = 0;
  for (int i = 0; i < (n); i++) {
    long long p;
    cin >> p;
    pl[i] = p;
    if (prei + 1 == i) {
      prei = 0;
    } else {
      prei = i;
      if (p == i + 1) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  system("pause");
}
