#include <bits/stdc++.h>
using namespace std;
int n, a[10005], dem;
bool b[10005];
int main() {
  cin >> n;
  dem = 0;
  for (int i = 0; i <= n; i++) b[i] = false;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] == i) {
      b[i] = true;
      dem++;
    }
  }
  for (int i = 0; i < n; i++) {
    if (b[i] == true && b[i + 1] == true) {
      dem--;
      b[i] = false;
      b[i + 1] = false;
    }
  }
  cout << dem;
}
