#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long INF = 1000000000000000000LL;
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i = 0; i < (n); i++) cin >> p[i];
  int ans = 0;
  vector<int> check(n);
  for (int i = 0; i < (n); i++) {
    if (p[i] == i + 1) check[i] = 1;
  }
  for (int i = 0; i < n; i += 2) {
    if (check[i] + check[i + 1]) ans++;
  }
  cout << ans << endl;
  return 0;
}
