#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const int MAX = 510000;
const long long MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int main() {
  long long n, ans = 0;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
  }
  if (a[0] == 1) {
    ans++;
    swap(a[0], a[1]);
  }
  for (long long i = (1); i < (n - 1); ++i) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
