#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, N, tmp, cnt = 0;
  int p[100001] = {0};
  int pp[100001] = {0};
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> p[i];
  }
  int flag;
  for (;;) {
    flag = 0;
    for (i = 1; i <= N; i++) {
      if (i == p[i - 1]) {
        tmp = p[i - 1];
        p[i - 1] = p[i];
        p[i] = tmp;
        cnt++;
        flag = 1;
        break;
      }
    }
    if (flag == 0) {
      break;
    }
  }
  cout << "cnt->" << cnt << endl;
  return 0;
}
