#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, ans;
vector<int> a(N);
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  int was = 1;
  while (was) {
    was = 0;
    for (int i = 1; i <= n; ++i) {
      if (a[i] == i) {
        if (i == 1)
          swap(a[i], a[i + 1]);
        else
          swap(a[i], a[i - 1]);
        ++ans;
        was = 1;
      }
    }
  }
  cout << ans;
}
