#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long int x) {
  for (long long int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
int main() {
  long long int A, B, C = 0, D = 0, E = 0, F = 0, G = 0, H = 0, N, M;
  cin >> N;
  vector<long long int> P(N);
  for (int i = 0; i < N; i++) cin >> P[i];
  for (int i = 0; i < N - 1; i++) {
    if (i + 1 == P[i] || i + 2 == P[i + 1]) {
      C++;
      swap(P[i], P[i + 1]);
    }
  }
  cout << C << endl;
}
