#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
int main() {
  int N;
  cin >> N;
  vector<int> vc(N + 1);
  for (int i = 1; i < (N + 1); i++) {
    cin >> vc[i];
  }
  int cnt{};
  for (int i = 1; i < (N + 1); i++) {
    if (i == vc[i] && i != N) {
      swap(vc[i], vc[i + 1]);
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
