#include <bits/stdc++.h>
using namespace std;
int a[114514];
int n, ans = 0;
signed main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    if (i == 0 && a[i] - (i + 1) == 0 && a[i + 1] - (i + 2) != 0)
      ans++;
    else if (a[i + 1] - (i + 2) == 0)
      ans++;
  }
  cout << ans << endl;
  getchar();
  getchar();
  return 0;
}
