#include <bits/stdc++.h>
using namespace std;
uint64_t MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> P(N);
  for (int n = 0; n < N; n++) cin >> P.at(n);
  vector<int> Dist(N);
  for (int n = 0; n < N; n++) Dist.at(n) = n - P.at(n) + 1;
  int ans = 0;
  for (int n = 0; n < N / 2 + 1; n++) {
    if (Dist.at(n) == 0) {
      int tmp = P.at(n);
      P.at(n) = P.at(n + 1);
      P.at(n + 1) = tmp;
      Dist.at(n) = n - P.at(n) + 1;
      Dist.at(n + 1) = n + 1 - P.at(n + 1) + 1;
      ans++;
    }
    if (Dist.at(N - 1 - n) == 0) {
      int tmp = P.at(n);
      P.at(n) = P.at(n + 1);
      P.at(n + 1) = tmp;
      Dist.at(n) = n - P.at(n) + 1;
      Dist.at(n - 1) = n - 1 - P.at(n - 1) + 1;
      ans++;
    }
  }
  cout << ans << endl;
}
