#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 10;
int n;
int p[N], p1[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i], p1[i] = p[i];
  ;
  int ans = 0, ans1 = 0;
  for (int i = 1; i <= n - 1; i++) {
    if (p[i] == i) {
      ans++;
      swap(p[i], p[i + 1]);
    }
    if (p[n] == n) ans++;
  }
  cout << ans;
  return 0;
}
