#include <bits/stdc++.h>
using ll = long long;
using graph = std::vector<std::vector<ll>>;
using namespace std;
int main() {
  int N;
  cin >> N;
  int p[N];
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }
  ll count = 0;
  for (int i = 0; i < N - 1; i++) {
    if (p[i] == i + 1) {
      int tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      count++;
    }
  }
  cout << count << endl;
}
