#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  std::cin >> N;
  std::vector<long long> P(N);
  for (auto& r : P) {
    std::cin >> r;
    --r;
  }
  long long ans = 0;
  for (long long i = 0; i < N - 1; ++i) {
    if (P[i] == i) {
      std::swap(P[i], P[i + 1]);
      ++ans;
    }
    if (P[N - 1] == N - 1) std::swap(P[i - 1], P[i]);
    ++ans;
  }
  std::cout << ans << std::endl;
  return 0;
}
