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