#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {1, -1, 0, 0};
const long long dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
void printA(vector<T> &printArray, char between = ' ') {
  long long paSize = printArray.size();
  for (long long i = 0; i < paSize; i++) {
    cerr << printArray[i] << between;
  }
  if (between != '\n') {
    cerr << endl;
  }
}
long long N;
long long p[111111];
signed main() {
  cin >> N;
  for (long long(i) = (0); (i) < (N); ++(i)) {
    cin >> p[i];
  }
  long long ans = 0;
  for (long long i = 1; i < N;) {
    long long a = i, b = i + 1;
    long long add = 1;
    if (p[i] == b || p[i - 1] == a) {
      swap(p[i - 1], p[i]);
      ans++;
      add = 2;
    }
    i += add;
  }
  cout << ans << endl;
  return 0;
}
