#include <bits/stdc++.h>

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> p(n);
  for (auto &i : p) {
    std::cin >> i;
  }

  int64_t count = 0;
  for (int64_t i = 0; i < n; i++) {
    if (p[i] == i + 1) {
      count++;
      i++;
    }
  }

  std::cout << count << std::endl;
  return 0;
}
