#include <bits/stdc++.h>
using namespace std;
long long factorial(long long n) {
  if (n == 0) {
    return 1;
  } else {
    return n * factorial(n - 1);
  }
}
double dist(pair<double, double> a, pair<double, double> b) {
  return sqrt(pow((a.first - b.first), 2) + pow((a.second - b.second), 2));
}
double ism(double aa, long long p) {
  double ap = aa;
  double ans = 1;
  while (p > 0) {
    if (p & 1) {
      ans *= ap;
    }
    p /= 2;
    ap = ap * ap;
  }
  return ans;
}
long long ismm(long long aa, long long p, long long m) {
  long long ap = aa;
  long long ans = 1;
  while (p > 0) {
    if (p & 1) {
      ans = (ans * ap) % m;
    }
    p /= 2;
    ap = (ap * ap) % m;
  }
  return ans;
}
struct all_init {
  all_init() { cout << fixed << setprecision(12); }
} All_init;
int main() {
  long long n, count = 0;
  cin >> n;
  vector<long long> p(n);
  for (long long i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (long long i = 0; i < n - 1; i++) {
    if (i == (n - 1) / 2 && (i + 1 == p[i] || i + 2 == p[i + 1])) {
      swap(p[i], p[i + 1]);
      count++;
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    if ((i + 1 == p[i]) || i + 2 == p[i + 1]) {
      swap(p[i], p[i + 1]);
      count++;
    }
  }
  cout << count << endl;
}
