#include <bits/stdc++.h>
using namespace std;
void inarray(int a[], int n) {
  for (int i = 0; i < n; i++) cin >> a[i];
}
int main() {
  int n;
  cin >> n;
  bool a[n];
  for (int i = 0; i < n; i++) {
    int A;
    cin >> A;
    if (A - 1 == i)
      a[i] = false;
    else
      a[i] = true;
  }
  int ans = 0;
  for (int i = 0; i < n; i += 2) {
    if (!a[i]) ans++;
    if (i + 1 < n && !a[i + 1]) ans++;
    if (!(a[i] || a[i + 1])) ans--;
  }
  cout << ans << endl;
  return 0;
}
