#include <iostream>

using namespace std;
const int MAXN = 100010;

int n;
int p[MAXN];

void solve() {
  int cnt = 0;
  for (int i=0;i<n;i++) {
    if (i == p[i] - 1) {
      swap(p[i], p[i+1]);
      cnt++;
    }
  }
  cout << cnt << endl;
}

int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> p[i];
  }
  solve();
}
