#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
using Graph = vector<vector<int>>;
static const long double GRATIO = (long double)(1 + sqrt(5)) / 2;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < int(N); ++i) cin >> p[i];
  int ans = 0;
  for (int i = 0; i < int(N - 1); ++i) {
    if (p[i] == i + 1) {
      int tmp = p[i];
      p[i] = p[i + 1];
      p[i + 1] = tmp;
      ans++;
    }
  }
  cout << ans << endl;
}
