#include <bits/stdc++.h>
static const int MAX = 100000;
static const int NIL = -1;
using namespace std;
long long calC(long long a, long long b) {
  if (a == 1) return 0;
  long long ans = 1;
  long long tmpB = b;
  long long tmpA = a;
  for (int i = 1; i <= b; i++) {
    ans *= tmpA;
    tmpA--;
  }
  for (int i = 1; i <= b; i++) {
    ans /= tmpB;
    tmpB--;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  bool flag = false;
  for (int i = 0; i < (int)(n); i++) cin >> p[i];
  int ans = 0;
  while (!flag) {
    flag = true;
    for (int i = 0; i < (int)(n - 1); i++) {
      if (p[i] == i + 1 || p[i + 1] == i + 2) {
        flag = false;
        int tmp = p[i];
        p[i] = p[i + 1];
        p[i + 1] = tmp;
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
