#include <bits/stdc++.h>
using namespace std;
long long a[100010];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] != i && a[i] == i + 1 && a[i + 2] == i + 2) continue;
    if (a[i] == i || a[i + 1] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
