#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> temp;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
