#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int main(void) {
  long long n;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < n; ++i) {
    cin >> p[i];
  }
  long long ans = 0;
  for (long long i = 0; i < n - 1; ++i) {
    if (p[i] - 1 == i) {
      p[i + 1] = p[i];
      ++ans;
    }
  }
  cout << ans;
}
