#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long cnt = 0;
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> a.at(i);
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (a.at(i) == i) {
      ans++;
    }
    if (a.at(i) == i && a.at(i + 1) == i + 1) {
      ans--;
    }
  }
  cout << ans << endl;
}
