#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 0x3f3f3f3f;
const long double epsilon = 10e-9;
const long long nax = 1e5 + 5;
long long n, arr[nax];
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  arr[n + 5] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] == i) {
      if (arr[i + 1] == i + 1) {
        i++;
        ans++;
      } else {
        ans++;
      }
    }
  }
  cout << ans << '\n';
}
