#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x * y / gcd(x, y); }
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long ans = 0;
  for (long long i = (0); i < (n); ++i) {
    cin >> a[i];
    if (a[i] == i + 1) {
      ans++;
      if (i >= 1 && a[i - 1] == i) ans--;
    }
  }
  cout << ans << endl;
}
