#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
template <class T>
using V = vector<T>;
template <class T>
using VV = vector<V<T>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const double PI = acos(-1), EPS = 1e-10;
const ll MOD = 1E9 + 7;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
template <class T>
istream &operator>>(istream &is, vector<T> &st) {
  for (size_t i = 0; i < st.size(); ++i) is >> st[i];
  return is;
}
template <class T>
istream &operator>>(istream &is, vector<vector<T>> &st) {
  for (size_t i = 0; i < st.size(); ++i) is >> st[i];
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &st) {
  for (size_t i = 0; i < st.size(); ++i) {
    if (i == st.size() - 1)
      os << st[i];
    else
      os << st[i] << " ";
  }
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const vector<vector<T>> &st) {
  for (size_t i = 0; i < st.size(); ++i) {
    os << st[i];
    if (i != st.size() - 1) os << endl;
  }
  return os;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi p(n);
  cin >> p;
  int ans = 0;
  for (ll i = (0); i < (ll)(n - 1); ++i) {
    if (p[i] == i + 1 && p[i + 1] == i + 2) {
      ans++;
      i++;
      swap(p[i], p[i + 1]);
    } else if (p[i] == i + 1) {
      ans++;
    }
  }
  cout << ans << endl;
}
