#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main(void) {
  int n;
  while (cin >> n) {
    int cot = 0, sum = 0;
    a[0] = 100000;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (a[i] == i) sum++;
    }
    for (int i = 1; i <= n; i++) {
      if (sum == 0) break;
      if (a[i] == i) {
        if (a[i + 1] == i + 1) swap(a[i], a[i + 1]);
        sum -= 2;
        cot++;
      } else {
        swap(a[i], a[i + 1]);
        sum--;
        cot++;
      }
      if (sum == 0) break;
    }
    cout << cot << endl;
  }
  return 0;
}
