#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<long long>;
using pii = pair<long long, long long>;
constexpr ll TEN(long long n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(long long& a, long long b) { return a > b ? (a = b, true) : false; }
bool chmax(long long& a, long long b) { return a < b ? (a = b, true) : false; }
ll read() {
  ll a;
  scanf("%lld", &a);
  return a;
}
const long long inf = TEN(9) + 10;
const long long mod = TEN(9) + 10;
signed main() {
  long long n;
  cin >> n;
  vi a(n);
  for (long long i = 0; i < (long long)n; ++i) {
    cin >> a[i];
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)n - 1; ++i) {
    if (a[i] == i + 1) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
}
