#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
long long INF = 1e18;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (p[i] == i + 1) {
        swap(p[i], p[i + 1]);
        cnt++;
      }
    } else {
      if (p[i] == i + 1) {
        swap(p[i - 1], p[i]);
        cnt++;
      }
    }
  }
  cout << cnt << endl;
}
