#include <bits/stdc++.h>
using namespace std;
const long long INF = INT_MAX;
const long long LINF = LLONG_MAX;
const long long MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long power(long long x, long long n, long long mod = MOD) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) {
      (ret *= x) %= mod;
    }
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
vector<long long> make_power(int n, long long base) {
  long long num = 1;
  vector<long long> ret;
  for (int i = 0; i <= n; ++i) {
    ret.push_back(num);
    num *= base;
  }
  return ret;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = (0); i < (n - 1); i++) {
    if (a[i] == i + 1 || a[i + 1] == i + 2) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
