#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
const long long INF = 1LL << 60;
using vll = vector<long long>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pair<long long, long long> = pair<long long, long long>;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  long long n;
  cin >> n;
  vll a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  a.push_back(INF);
  for (int i = 0; i < n; i++) {
    if (a[i] == i + 1 && a[i + 1] == i + 2) {
      ans++;
      i++;
    } else if (a[i] == i + 1 || a[i + 1] == i + 2) {
      ans++;
      i++;
    }
  }
  cout << (ans) << endl;
}
