#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
using namespace std;
int a[maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i)
      a[i] = 1;
    else
      a[i] = 0;
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    if (i == n) {
      if (a[i] == 1) sum++;
    } else {
      if (a[i] == 1 && a[i + 1] == 0) {
        sum++;
        a[i] = 0;
        a[i + 1] = 1;
      } else if (a[i] == 1 && a[i + 1] == 1) {
        sum++;
        a[i] = 0;
        a[i + 1] = 0;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
