#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long int n;
  std::cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) std::cin >> a[i];
  long long int c = 0;
  for (long long int i = 0; i < n - 1; i++) {
    if (a[i] == i + 1) swap(a[i], a[i + 1]), c++;
  }
  std::cout << c << '\n';
  return 0;
}
