#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, ans = 0, memo = -1;
  cin >> N;
  for (long long i = (long long)(1); i <= (long long)(N); i++) {
    long long X;
    cin >> X;
    if (X == i) {
      if (memo != i - 1)
        ans++;
      else
        memo = i;
    }
  }
  cout << ans;
}
