#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int dy[] = {0, 0, 1, -1};
const int dx[] = {1, -1, 0, 0};
template <class T>
void chmin(T& a, const T& b) {
  a = min(a, b);
}
template <class T>
void chmax(T& a, const T& b) {
  a = max(a, b);
}
int cnt[100000];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, res = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> cnt[i];
  for (int i = 1; i < n; ++i) {
    if (i == 1) {
      if (cnt[i] == i + 1 && cnt[i - 1] == i) {
        ++res;
        ++i;
      } else if (cnt[i - 1] == i) {
        ++res;
        ++i;
      }
      continue;
    }
    if (cnt[i] == i + 1 && cnt[i - 1] == i) {
      ++res;
      ++i;
    } else if (cnt[i] == i + 1)
      ++res;
  }
  cout << res << endl;
  return 0;
}
