#include <bits/stdc++.h>
using namespace std;
int n, a[10000];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int dem = 0;
  for (int i = 1; i <= n; i++) {
    while (a[i] == i) {
      swap(a[i], a[i + 1]);
      i = i + 1;
      dem++;
    }
  }
  cout << dem;
}
