#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll INF = 1001001001;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int cnt = 0;
  int buf;
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
    if (i > 1) {
      if (a[i] == i + 1) {
        buf = a[i];
        a[i] = a[i - 1];
        a[i - 1] = buf;
        cnt++;
      }
    } else if (i < 1 && a[0] == 1) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
