#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  vector<int> p;
  int count = 0;
  int temp;
  int flag = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    p.push_back(temp);
  }
  int i = 0;
  while (1) {
    for (i = 0; i < n; i++) {
      if (p[i] == i + 1) {
        count++;
        if (i == 0) {
          (temp = p[i], p[i] = p[i + 1], p[i + 1] = temp);
          flag = 1;
        } else if (i == n - 1) {
          (temp = p[i], p[i] = p[i - 1], p[i - 1] = temp);
        } else {
          if (flag == 0) {
            (temp = p[i], p[i] = p[i + 1], p[i + 1] = temp);
            flag = 1;
          } else if (flag == 1) {
            (temp = p[i], p[i] = p[i - 1], p[i - 1] = temp);
            flag = 0;
          }
        }
      }
    }
    if (i == n) {
      break;
    }
  }
  cout << count << endl;
  return 0;
}
