#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int inf = 1 << 20;
const long long INF = 1LL << 60;
using namespace std;
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == i + 1) ans++;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] + 1 == a[i + 1]) {
      ans--;
      i++;
    }
  }
  cout << ans << endl;
}
