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