#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
int P[MAX_N];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> P[i];
  }
  bool flag = false;
  int count = 0;
  for (int i = 0; i < n; i++) {
    flag = false;
    for (int j = i; j < n - 1; j++) {
      if (P[j] == j + 1) {
        int temp = P[j];
        P[j] = P[j + 1];
        P[j + 1] = temp;
        flag = true;
        count++;
      }
    }
    if (flag == false) {
      break;
    }
  }
  cout << count << endl;
}
