#include <bits/stdc++.h>
constexpr long long INF = 1000000000;
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> p(n);
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> p[i];
  for (int i = 0; i < (n); i++) a[i] = i + 1;
  int count = 0;
  for (int i = 0; i < n - 1; i++) {
    if (p[i] == a[i] && p[i + 1] == a[i + 1] && p[i] + 1 == p[i + 1]) {
      count++;
      swap(p[i], p[i + 1]);
    } else if (p[i] == a[i]) {
      count++;
      swap(p[i], p[i + 1]);
    }
  }
  cout << count << endl;
}
