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