#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
void vprn(vector<int> &v) {
  for (int i = 0; i < v.size(); i++)
    cout << v[i] << (i < v.size() - 1 ? ",\t" : "\n");
}
ll solve(int N, vi &P) {
  ll ans = 0;
  for (int i = (1); i < (N); ++i) {
    if (P[i - 1] - 1 == i - 1) {
      swap(P[i - 1], P[i]);
      ans += 1;
      i++;
    }
  }
  if (P[N - 1] - 1 == N - 1) {
    swap(P[N - 1], P[N - 2]);
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vi P(N);
  for (int i = (0); i < (N); ++i) cin >> P[i];
  cout << (solve(N, P)) << endl;
}
