#include <bits/stdc++.h>
using namespace std;
long n;
long a[100050];
int main() {
  cin >> n;
  long q = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) q++;
  }
  long dem = 0, i = 1;
  while (q > 0 && i <= n) {
    if (a[i] == i && a[i + 1] == i + 1) {
      dem++;
      q = q - 2;
      i = i + 2;
    } else if (a[i] == i) {
      dem++;
      q = q - 1;
      i = i + 1;
    } else
      i++;
  }
  cout << dem;
}
