#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long count = 0;
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    if (i + 1 == tmp) {
      a[i] = 1;
    } else {
      a[i] = 0;
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    if (a[i] == 1) {
      swap(a[i], a[i + 1]);
      count++;
    }
  }
  if (a[n] == 1) {
    count++;
  }
  cout << count << endl;
}
