#include <bits/stdc++.h>
using namespace std;
long long t;
long long arr[200005];
int main() {
  long long a, b, c, d, e, f, g, i, j;
  cin >> a;
  for (i = 1; i <= a; i++) cin >> arr[i];
  b = 0;
  for (i = 1; i <= a; i++) {
    if (i == 1 && arr[i] == i) {
      swap(arr[i], arr[i + 1]);
      b++;
    } else if (arr[i] == i) {
      swap(arr[i], arr[i - 1]);
      b++;
    }
  }
  cout << b << endl;
}
