#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(long long N, std::vector<long long> p) {
  ll ans = 0;
  for (long long i = 0; i < N - 1; i++) {
    if (p[i] == i + 1) {
      swap(p[i], p[i + 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++) {
    scanf("%lld", &p[i]);
  }
  solve(N, std::move(p));
  return 0;
}
