#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[100000];
  long long n, t, t1 = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == i + 1) {
      t = a[i];
      a[i] = a[i + 1];
      a[i + 1] = t;
      t1++;
    }
  }
  cout << t1;
  return 0;
}
