#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
template <typename T>
void print(const T& v);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < (int)(N); i++) cin >> p[i];
  vector<int> cp = p;
  int cnt1 = 0;
  for (int i = 0; i < N - 1; i++) {
    if (p[i] == (i + 1) || p[i + 1] == (i + 2)) {
      swap(p[i], p[i + 1]);
      cnt1++;
    }
  }
  int cnt2 = 0;
  for (int i = N - 1; i > 0; i--) {
    if (cp[i] == (i + 1) || cp[i - 1] == i) {
      swap(cp[i], cp[i - 1]);
      cnt2++;
    }
  }
  cout << min(cnt1, cnt2) << endl;
  return 0;
}
template <typename T>
void print(T const& v) {
  for (int i = 0; i < v.size(); i++) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
