#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> ar(n);
  for (int i = 0; i < n; ++i) {
    cin >> ar[i];
  }
  int ans = 0;
  if (ar[0] == 1) {
    swap(ar[0], ar[1]);
    ans++;
  }
  for (int i = 1 + ans; i < n; ++i) {
    if (ar[i] == i + 1) {
      swap(ar[i], ar[i - 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
