#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  long long cnt = 0;
  long long time = 0;
  cin >> N;
  vector<long long> P(N + 1);
  long long i;
  for (i = 0; i < N; i++) cin >> P[i];
  while (1) {
    for (i = 0; i < N - 1; i++) {
      if (P[i] == i + 1) {
        swap(P[i], P[i + 1]);
        cnt++;
      } else
        time++;
    }
    if (time == N - 1) break;
    time = 0;
  }
  cout << cnt << endl;
}
