#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int N, a[100010];
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N - 1; i++) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
